Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
83
rated 0 times [  90] [ 7]  / answers: 1 / hits: 31544  / 11 Years ago, mon, november 18, 2013, 12:00:00

i'm binding a function to an event with



window.onbeforeunload = function() {
somefunction()
}


which is working on unload as planned, but if they cancel the onbeforeunload the function is still attached, is it possible to check if the user cancels onbeforeunload


More From » jquery

 Answers
12

Actually, I found it was quite easy: I just set



window.onbeforeunload = null;


for each click before it was run, allowing the event handler to be run afterwards.


[#74211] Sunday, November 17, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hallie

Total Points: 503
Total Questions: 114
Total Answers: 103

Location: Iraq
Member since Fri, Jun 5, 2020
4 Years ago
;