jorveld
jorveld

Reputation: 1

Unloading a window in Firefox

I'm looking for a Firefox-specific way to unload the current window when the URL changes. If I don't unload the window, content doesn't load correctly when the user presses the 'Back' button. Internet Explorer displays the behavior I want - it loads things okay. So I don't want to add any code that breaks that.

Here's the code I'm currently using:

if (typeof clientInformation == 'undefined') {
    window.addEventListener('unload', UnloadHandler, false);
};  

function UnloadHandler() {
    //do nothing
};

Is this the best way to do this or are there easier ways?

Upvotes: 0

Views: 1271

Answers (1)

David Hellsing
David Hellsing

Reputation: 108500

You can try the onbeforeunload listener in Firefox:

https://developer.mozilla.org/en/DOM/window.onbeforeunload

Upvotes: 1

Related Questions