简体   繁体   English

更改location.hash,然后按“后退”按钮-IE的行为与其他浏览器不同

[英]Change location.hash and then press Back button - IE behaves differently from other browsers

I change location.hash - in all browsers this behave properly - the page remains original and changes only URL without reload the page. 我更改了location.hash在所有浏览器中均正常运行-该页面保持原始状态,仅更改了URL,而无需重新加载该页面。

Pressing Back button behaves differently in Internet Explorer and other browsers. 在Internet Explorer和其他浏览器中,按Back按钮的行为有所不同。 IE does not change the history location.hash and goes to the previous page. IE不会更改历史记录location.hash并转到上一页。 Other browsers only change the URL (change the hash). 其他浏览器仅更改URL(更改哈希)。

Is there any way to force IE browser to behave just like the others? 有什么方法可以强制IE浏览器像其他浏览器一样运行?

(Moving my comment here and expanding on it a little.) (在这里发表我的评论,并扩大一点。)

There are several other questions regarding the #hashtag history quirks with IE. 关于IE的#hashtag历史怪癖,还有其他 几个 问题

Essentially, IE doesn't treat different #hashtags as separate entries in its History object. 本质上,IE不会在其“历史记录”对象中将不同的#hashtags视为单独的条目。

The best solution appears to be the jQuery History Plugin . 最好的解决方案似乎是jQuery History Plugin

Note- jquery history is no longer maintained and the former maintainers recommend Jquery hashchange 注意-不再保留jquery历史记录,以前的维护者建议使用jquery hashchange

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM