mah*_*han 5 html javascript firefox jquery html5
我有一个页面,可以将整个身体的动画从观众的屏幕中移出来作为过渡.它工作正常,但当用户点击浏览器中的后退按钮时,Firefox会从没有正文的历史记录中显示缓存页面.
因此,通过后退按钮访问页面时,重新加载页面非常简单.
我已经尝试了以下代码来重新加载页面,以避免重复重新加载.
<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">
Run Code Online (Sandbox Code Playgroud)
它没有解决问题,因为甚至没有调用匿名函数.
所以我尝试设置标题,以便浏览器不会缓存页面.
<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">
Run Code Online (Sandbox Code Playgroud)
它也没有解决问题.
该页面在Chrome中正常运行.
我使用的Firefox版本是12.0
如何使用Javascript,JQuery或任何其他客户端脚本重新加载页面?
导航回内存缓存页面时,不会触发onload事件.
我认为你有三个主要选择: