开发者

Is it possible for PHP to generate a fresh page on every Javascript 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);
&开发者_如何学Clt;/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.


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.


you could try server variable HTTP_REFERER

header('Location: '.$_SERVER["HTTP_REFERER"]);


you can use meta tags to not cache the page, page will beloaded again then.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜