我知道 IE 不支持 pushState,但我想要一种方法让使用现代浏览器的用户享受这些好处,而使用旧浏览器的用户则不会使用它。
目前,javascript 代码阻止我的选项卡式导航在 IE 中完全工作,这意味着无法看到很多内容。
有人知道我的问题的解决方案吗?
这是我的 JavaScript 代码:
var tabContents = $(".tab_content").hide(),
tabs = $(".tab_nav li");
tabs.first().addClass("active").show();
tabContents.first().show();
tabs.click(function() {
var $this = $(this),
activeTab = $this.find('a').attr('href');
history.pushState(null, '', activeTab);
if(!$this.hasClass('active')){
$this.addClass('active').siblings().removeClass('active');
tabContents.hide().filter(activeTab).fadeIn();
}
return false;
});
$(window).bind('popstate', function(){
$.getScript(location.href);
});
最佳答案
试试 jQuery BBQ: Back Button & Query Library .我使用它取得了巨大的成功。
关于javascript - Internet Explorer 的 pushState 回退?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6823825/