我的问题是这样的,但我的问题不在 IE(未测试)中,而是在 Chrome 和 Firefox 中。无论如何,这个问题没有答案。
我正在使用BBQ 插件,代码如下:
$(window).bind('hashchange', function(e) {
var href = $.param.fragment();
hrefOld = $("#loadZone").attr("src");
centerZoneActivePage = href;
// Create container for this url's content and store a reference to it in
// the cache.
cache[ href ] = $("#loadZone").attr("src", href);
alert("new: " +href);
});
// Since the event is only triggered when the hash changes, we need to trigger
// the event now, to handle the hash the page may have loaded with.
$(window).trigger( 'hashchange' );
正在发生的事情是,当我在 iframe(“#loadZone”)中加载新页面时,哈希值正在正确更改。但是当我点击浏览器后退按钮时,前一页正在加载,但没有改变哈希。当第二次点击时,hash 改变并且活动页面保持在 iframe 中。我不明白为什么哈希在第一次没有改变,因为上一页加载。
注意:警报消息仅在第二次单击后退按钮时出现。
后退按钮点击总结:
- 首次点击:Iframe 上一页加载,不显示警告信息,hash 未更改;
- 第二次点击:iframe 页面还是一样,提示信息显示,hash 改变。
这个怎么同步?我正在使用 jquery-1.7.1.js。有人用过这个版本的BBQ插件,成功了吗?我已经阅读了这个问题,但它不是决定性的。