Reputation: 39055
I have a function like this to prompt the user to confirm they want to navigate away from the page:
window.onbeforeunload = function() {
return "You may lose any unsaved changes.";
};
Now I'd like to check whether this is a just a page refresh (F5), and not render the message in this case. Is this possible?
Thanks
Upvotes: 2
Views: 1395
Reputation: 382696
Nope, that's not possible, there is no way to find out if the refresh button of browser was pressed.
Upvotes: 3