后退按钮在IE中启用深层链接 [英] Back Button enabled deep-linking in IE
问题描述
这是SWFAddress已修复的问题。但基本上,我想写我自己的解决方案,去掉很多未使用的函数。下面的解释:
您可以使用下面的代码来获取像这样的URL链接的哈希值xxx.xxx.com/?#/DeepLinking/
window.location.hash
与 href ='#tab1
...等一起使用锚标签。和Javascript,你可以做深层链接工作。每当哈希变化时,我都可以为用户提供不同的内容。
使用后退按钮和 window.location时会出现问题。散列
。在除IE之外的其他浏览器中,如果使用后退按钮返回到之前的哈希符号状态,则 window.location.hash
会返回正确的值。在IE中,它不会返回当前的哈希值,而是在任何后退按钮被按下之前。
我看到一个Iframe修复,但我不确定它究竟如何作品?请提供一个框架不可知的解决方案。谢谢!
我会看看 YUI 2:浏览器历史记录管理器 。浏览其源代码,看看他们是如何做到的。
编辑:或者看看 library-source / browse / trunk / closure / goog / history / history.jsrel =nofollow noreferrer> history.js 。This is a problem that SWFAddress have fixed. But essentially, I'd like to write my own solution that strips out a lot of unused functions. Explanation below:
You can use the following code to get the hash value of the an URL link like this xxx.xxx.com/?#/DeepLinking/
window.location.hash
Using anchor tags with href='#tab1
...etc. and Javascript, you can make deep linking work. Whenever the hash changes, I can serve the user different content.
The problem comes up when you use the back button and the window.location.hash
. In other browsers other than IE, if you use the back button to go back to a previous hash symbol state, the window.location.hash
returns the correct value. In IE, it does not return the current hash value but the one before any Back button was pressed.
I saw an Iframe fix but I'm not sure how exactly it works? Please provide a framework agnostic solution. Thanks!
I would have a look at the YUI 2: Browser History Manager. Browse through its sources to look how they did it.
EDIT: Or have a look at history.js from Google's Closure Library.
这篇关于后退按钮在IE中启用深层链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!