I am looking for a way to identify if user refreshes a page or hits F5 using Javascript (more specifically prototype Javascript library)…
I am coding an application that needs to record the number of refresh(es) or F5 on a web page for statistics purposes. A refresh or F5 in this case means the user is skipping or escaping doing his work on the page 🙂 So the statistics helps them find how many of them are doing it :).. Kind of policing…
Put the following piece of code on each page (only then you can differ between refreshing/navigating):
It only differs between navigating on the same domain and not doing so (i.e. going to another website and then going back to the same page counts as a refresh).