PHP 是否可以在每个 Javascript History.go(-1) 上生成一个新页面?
我有一个 PHP 页面(a.php),它已经发送了这些标头:
<?php
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Pragma: no-cache');
?>
在 PHP 页面(a.php)上,它有一个指向 b.html
上另一个页面(b.html)的链接,它有一个 javascript 代码to:
<script type="text/javascript">
history.go(-1);
</scirpt>
在我看来,当浏览器“返回”a.php时,内容一点也不新鲜。
请您告诉我是否可以在 history.go(-1)
上生成一个全新的页面?
谢谢。
I have a PHP page (a.php) which is already sending these headers:
<?php
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Pragma: no-cache');
?>
And on the PHP page (a.php) , it has a link to another page (b.html)
on b.html, it has a javascript code to:
<script type="text/javascript">
history.go(-1);
</scirpt>
It seems to me that, when the browser is "going back" to a.php,the content isn't fresh at all.
Would you please advise me if generating a completely fresh page on history.go(-1)
is possible?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,返回是浏览器的事情。它只是返回到缓存中的上一页。页面内容未完全重新加载。
我建议重定向到一个新页面(即使它是 a.php)而不是返回到它。
Well going back is a browser thing. It simply goes back to the previous page in the cache. The page content is not entirely reloaded.
I recommend redirecting to a new page (even if it is a.php) instead of going back to it.
你可以尝试服务器变量 HTTP_REFERER
you could try server variable HTTP_REFERER
您可以使用元标记不缓存页面,然后页面将再次加载。
you can use meta tags to not cache the page, page will beloaded again then.