浏览器后退按钮在缓存环境中不起作用

时间:2008-10-16 13:29:22

标签: browser caching button back

后退按钮只会导致我的页面刷新。有没有办法绕过这个而不禁用缓存?

2 个答案:

答案 0 :(得分:1)

尝试将其添加到HTML标题中:

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

答案 1 :(得分:0)

点击页面上的产品/图片,然后调用onclick javascript函数,即

function getHashOnBack(valueget) 
{
   location.hash = "#backTo=" + $(window).scrollTop();$(document).height();
}

现在,把

$(document).ready(function () 
{
 var ab = window.location.hash.substring(1).split("=");
 if (ab[0] == "backTo") 
 {
  // this would be called automatically when back putton pressed and hav #back=1234   etc. // value in url

  $(window).scrollTop(parseInt(ab[1]));
}
}