2014-02-18 46 views
0

我正在创建一个幻灯片,它正在改变图像与jQuery。当我更改图像时,我也更改页面标题和页面网址,无需重新加载页面。我正在更改网址:Window.history浏览器不加载页面 - jQuery - HTML5

window.history.pushState({path:url},'',curentImage[3]); 
rightNav.click(function(){ 
    imageArea.append(curentImage[2]); 
    title.text(curentImage[4]); 
    window.history.pushState({path:url},'',curentImage[3]); 
}); 

如果我点击浏览器,它会将url更改为上一个,但不会加载该页面。当我点击浏览器后退按钮时,如何加载以前的网址页面?

回答

0

我刚刚想出了解决方案,帮助我的情况。我添加了popstate的事件监听器,它将我重定向到我的网址,一些默认网址,或者可以设置为之前的网址。

window.addEventListener("popstate", function(e) { 
     window.location.href = defUrl; 
}); 
相关问题