I am designing a HTML page, and I would like to send a simple message (or trigger some action) when the user intentionally request updating (update button on the web browser, pressing F5... or whatever any other manual method that could exist) of the HTML file. Something like:
window.onmanualupdaterequest = alert("You requested update");
Or whatever the correct procedure could be.
How could I do this?
Further notes:
- I have tried the
window.onbeforeunload
function (example), but it does not exactly solve the problem (I would say it has not the same behavior as user request). - I would like to ignore the autoupdate case (like in
setInterval
or similar functions or scripts) from the manual update case. This question is about the manual one. - The classical Android swipe-down update method for a web page is considered here as a manual update method.