How can i count how many times user pressed refresh in javascript? When user closed the page and open again, it should count from 0 again.
Asked
Active
Viewed 75 times
0
-
it's not easy to 100% distinguish between a refresh and a close/open (events would be unload/load) - because a refresh would trigger unload then load events - you could store (localStorage or cookie) the `unload` time and if the next `load` time is within some arbitrary period, consider it as a refresh – Jaromanda X Dec 05 '16 at 00:20
-
Related: [Check if page gets reloaded or refreshed in Javascript](http://stackoverflow.com/q/5004978/5743988) – 4castle Dec 05 '16 at 00:21