I am trying to write a onbeforeunload event that triggers a window.open(url) etc. I want it to be triggered if the user trys to leave the page or if they close their browser, but not when they click any of the buttons on the page. The buttons on the page post data to the same page via a javascript. javascript:
Tag: onbeforeunload
window.onbeforeunload in Chrome: what is the most recent fix?
Obviously, window.onbeforeunload has encountered its fair share of problems with Chrome as I’ve seen from all the problems I’ve encountered. What’s the most recent work around? The only thing I’ve got even close to working is this: However, if I substitute return “alert” with something like alert(“blah”), I get nothing from Chrome. I saw in this question that Google purposefully
How can I override the OnBeforeUnload dialog and replace it with my own?
I need to warn users about unsaved changes before they leave a page (a pretty common problem). This works but it raises a default dialog with an irritating standard message that wraps my own text. I need to either completely replace the standard message, so my text is clear, or (even better) replace the entire dialog with a modal dialog