如何在任何浏览器中单击“返回”按钮时重新加载页面

3

我已经创建了一个HTML页面,名为example page1.html,其中设置了onclick调用page2.html。

点击返回按钮时,页面1会加载所有以前的数据。我希望完全重新加载页面,并且不想记住任何设置。

祝好, Dev

2个回答

2

请设置以下标头:

Pragma: no-cache
Cache-control: no-cache
expires: 0

1
我已经尝试过这个,但是在点击返回按钮时页面没有刷新。 - Christian Vielma

1
最简单的方法是让page1过期-例如
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

在那个页面的头部


哦,使用window.name检查页面是否已经被访问的评论很有趣。你也可以在那里使用时间戳。第二个代码评论:http://dev.opera.com/forums/topic/224464 - mplungjan
我尝试了但它没有起作用........... <?php include("CheckProcessingData.php"); ?><html> <head> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> - Dev
meta http-equiv标签对于某些头部信息不起作用。对于那些不起作用的头部信息,必须使用真正的头部信息(例如通过PHP中的header()函数)。 - Delan Azabani
我已经尝试过这个,但是在点击返回按钮时页面没有刷新。 - Christian Vielma
什么浏览器,什么平台,什么缓存设置? - mplungjan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接