为什么按下后退按钮时Firefox 5.0.1不刷新此页面?为什么Firefox 5会忽略document.ready?
<html>
<head>
<meta http-equiv="cache-control" content="no-cache">
<script src="http://code.jquery.com/jquery-1.6.2.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() { alert('ready'); });
$(window).load(function() { alert('load'); });
</script>
</head>
<body>
<form action="http://www.google.com" method="get">
<input name="q" type="text">
<input type="submit">
</form>
</body>
</html>
重现步骤:
- 点击 “提交按钮”
- 按返回
- 既不的document.ready或window.load火灾
更新:
这将迫使火狐刷新页面:
$(window).unload(function() {});
但是,我结束了使用此:
window.addEventListener('pageshow', function() {alert('pageshow'); }, false);
+1 Firefox不会重新加载任何资源,并且在“按回”时不会触发任何回调。我用萤火虫调试它 – Anatoly
$(document).ready()似乎对我来说...至少在jsfiddle iframe中 - > http://jsfiddle.net/qwRPS/ – Tomm
@Tomm yes ready for fires for me在您的jsfiddle.net示例中,现在介绍如何让我的独立示例正常工作。 –