Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
175
rated 0 times [  179] [ 4]  / answers: 1 / hits: 74220  / 13 Years ago, thu, february 16, 2012, 12:00:00

On my HTML page, when the user clicks / presses F5 button the page refreshes, but before it refreshes I want to execute a function or a simple alert.



User can click on refresh button, press F5 or Ctrl + R.



Using core JavaScript, jQuery or YUI.


More From » jquery

 Answers
26
    window.onbeforeunload = function(event)
{
return confirm(Confirm refresh);
};

[#87430] Tuesday, February 14, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dusty

Total Points: 739
Total Questions: 97
Total Answers: 85

Location: Angola
Member since Wed, Apr 13, 2022
2 Years ago
;