Firefox OnBeforeUnload Fun!
So Kevin correctly pointed out that you can do the same onbeforeunload behavior in Firefox as you can in Internet Explorer. It does require a little bit of a tweak to use the DOM event model, though:
window.onbeforeunload = function (oEvent) {
oEvent.returnValue = "blah";
}
See, even JavaScript authors can learn something new every once in a while!
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.
Both comments and pings are currently closed.




2 Comments
I think you wanna add:
if(!oEvent) oEvent = window.event;
to the above so it works in IE again
José Jeria on March 2nd, 2006 at 5:12 am
Sorry, I am blind, i though this was the same post as before, but updated…
José Jeria on March 2nd, 2006 at 11:53 am
Comments are automatically closed after 14 days.