Lock up
Lock up

Reputation: 235

window.onunload event

i am using confirm dialogue box on the window.onunload event.but when i click the cancel button it will navigate me to another page but i want to stay on that page. is this a problem of window.onunload event. please give me solution for this problem. also tell me another window event instead of it.But i do not want to use onbeforeunload event

Upvotes: 1

Views: 316

Answers (1)

thomasrutter
thomasrutter

Reputation: 117401

If you use onunload (rather than onbeforeunload) you can't prevent the page unloading because that event is fired after the browser has committed to unloading the page.

This is why unbeforeunload was invented.

This conversation may give you some more insights: http://codingforums.com/showthread.php?t=153514

Upvotes: 2

Related Questions