Hey guys these code below works on chrome and IE and the older version of FF. But not working on the latest (firefox is showing their own alert instead)....can something be done? <script language="JavaScript"> var allowConfirm = true; window.onbeforeunload = confirmExit; function confirmExit() { if(allowConfirm) return "You're about to be redirected"+ '\n'+ "IF this is UNIntentional --- Kindly click [CANCEL]/[Stay on Page]"; else allowConfirm = true; } </script> Code (markup):
Did some research, and this seems to have been "bugged" since Firefox 4. Apperantly Mozilla doesn't want us to add custom messages to the onbeforeunload event messagebox. https://bugzilla.mozilla.org/show_bug.cgi?id=588292 Comment #76 provided a decent workaround; https://bugzilla.mozilla.org/show_bug.cgi?id=588292#c76 However, your users would end up getting either 2 message boxes or a DIV that they wouldn't read anyway.