views:

316

answers:

1

I have a page that has a selectbox that changes the window.location using hashes to modify the hash state when an option is selected. This allows a user to click forward and back to navigate the different select options. All works well until you click a link to navigate away from the page and then click the browser's back button to attempt to navigate back. The browser (Firefox 3.6) does not maintain the selected state of the selectbox, it seems to automatically revert to the top item. However, IE 8 does seem maintain the selected state.

Also, when using the back button the document.ready (jquery) event doesn't get fired so there's seemingly no way to remedy this using that event. Any ideas?

+1  A: 

Please don't use the unload event "hack" blindly for the reasons I described in my answer.

For your problem seems the correct solution would consist of two parts:

  1. adding a pageshow event handler that sets the select's value for Firefox.
  2. Coming up with a simplified testcase of the problem and showing it here and later filing a bug about it with the browser vendor. From your description it doesn't seem that this behavior is intended.
Nickolay