我有一个页面,可以将整个页面动画移出视图,作为过渡效果。它工作得很好,但是当用户在浏览器中点击后退按钮时,Firefox会从历史记录中带回缓存的页面,该页面没有body。
因此,我可以通过重新加载被后退访问的页面来解决这个问题。
我尝试了以下代码,以便避免重复加载:
因此,我可以通过重新加载被后退访问的页面来解决这个问题。
我尝试了以下代码,以便避免重复加载:
<script type="text/javascript">
window.onload=function(){
var e=document.getElementById("refreshed");
if(e.value=="no")e.value="yes";
else{e.value="no";location.reload();}
}
</script>
<input type="hidden" id="refreshed" value="no">
由于匿名函数没有被调用,因此它并没有解决问题。
因此,我尝试设置标头,以便浏览器不缓存页面。
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
这并没有解决问题。
在Chrome中,该页面运行良好。
我使用的Firefox版本是12.0。
我该如何使用Javascript、JQuery或其他客户端脚本重新加载页面?