jQuery(document).ready(function() {
debugger;
if (window.event) {
if (window.event.clientX < 40 && window.event.clientY < 0) {
alert("Browser back button is clicked...");
} else {
alert("Browser refresh button is clicked...");
}
} else {
if (event.currentTarget.performance.navigation.type == 1) {
alert("Browser refresh button is clicked...");
}
if (event.currentTarget.performance.navigation.type == 2) {
alert("Browser back button is clicked...");
}
}
});
Asked
Active
Viewed 1,323 times
0

Adam Azad
- 11,171
- 5
- 29
- 70

bablu Parhi
- 7
- 5
-
2What would you expect? You need to access the clientX in a click event, not a pageload event. clientX is a [mouse event property](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientX) – mplungjan Jul 05 '16 at 07:56
-
I want to reset my all filed on click of back button of browser. That's why i am identifying is it page refresh or it is back button click. – bablu Parhi Jul 05 '16 at 07:58
-
That is important information - right now it is an X/Y problem. Perhaps you could look for "detect back or refresh" like this one http://stackoverflow.com/questions/6359327/detect-back-button-click-in-browser – mplungjan Jul 05 '16 at 08:06
-
Exactly @mplungjan . I want to detect page refresh or page back button. – bablu Parhi Jul 05 '16 at 09:23