开发者

Firefox (3.6) Selectbox State and Browser Back Button

开发者 https://www.devze.com 2022-12-19 16:42 出处:网络
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 diffe

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?


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消