How to get event of page refresh. i want to detect that user has refreshed page
From stackoverflow
-
not sure how to do it in Jquery
window.onbeforeunload = function (e) { var e = e || window.event; // For IE and Firefox if (e) { e.returnValue = 'Any string'; } // For Safari return 'Any string'; };
https://developer.mozilla.org/en/DOM/window.onbeforeunload
rahul : This will catch refresh, back, forward, and closing of the window -
On $(document).load()
- read a var current_page from cookie
- if it's the same as your current page, you have a refresh
- write current page to var current_page in cookie
pradeep : can u provide an example for the same
0 comments:
Post a Comment