JS event | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

JS event

Hi, how to know if the user touch the back button on his phone ?

10th May 2018, 4:59 PM
NoxFly
NoxFly - avatar
4 Answers
+ 8
Use touch event
1st Jun 2020, 12:19 PM
Coder
Coder - avatar
+ 7
You can use HTML5 History API and some logic to determine whether user has pressed back button or not.
12th May 2018, 4:55 AM
Vikash Pal
Vikash Pal - avatar
+ 4
You Mean In a Browser??
10th May 2018, 5:16 PM
Niush
Niush - avatar
+ 1
Mighty Coder it's not a normal touch event, it's the back button of a samsung device (for example). it will not works with a basic touch event handler.
1st Jun 2020, 12:23 PM
NoxFly
NoxFly - avatar