12

Flowchart diagramI have written a login script to redirect back to the index page once you have logged in, and thus reloading the index page for a logged in user, it just displays the previously loaded index page. The new Firefox 12 update doesn't reload the index page once the login script has redirected it back. This problem occurs again and again throughout my site when the processing script redirects Firefox back to a page it has already loaded.

Ive tried turning off caching in PHP with:

<?php
header( "Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
header( "Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
header( "Cache-Control: no-store, no-cache, must-revalidate" );
header( "Cache-Control: post-check=0, pre-check=0", FALSE );
header( "Pragma: no-cache" ); ?>

and in .htaccess with:

<filesMatch "\.(php)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>

Can anyone explain why Firefox 12.0 is doing this? It doesn't do it in other browsers. How can it be solved as soon as possible?

Thanks.

UPDATE: It worked fine in the previous version of Firefox and all other browsers. All it's doing is redirecting back to the index page where it should reload for the newly logged in user, yet it still displays the original home page. When you click a link to the homepage it will then load the homepage properly for the user.

4

6 回答 6

1

从 Firefox 11 升级到 12 后,我注意到了同样的问题。我的购物车不再正常工作,除非我在每个请求的 URL 上附加一个随机字符串。

http://support.mozilla.org/en-US/questions/926043

于 2012-05-03T11:31:11.277 回答
1

刚刚设置

header("Cache-Control: no-cache");

在你之前

header("Location:".$url);

问候,丹尼尔

于 2012-05-08T14:55:15.930 回答
0

您应该在重定向 URL 中添加时间戳:

http://yourdomain.com/index.php?time=0205122019

我认为这是一个缓存问题。

于 2012-05-03T17:19:49.517 回答
0

我在其他帖子中看到的一个有趣的技巧是关于防止 FF 缓存页面。这是一个较旧的文档,但可能仍然适用:(https://developer.mozilla.org/en/Using_Firefox_1.5_caching),说 FF 不会缓存带有 unload 或 onbeforeunload 事件的页面。

添加一个什么都不做的 onbeforeunload 事件怎么样:

<script>
    window.onbeforeunload = function(){} //add onbeforeunload
</script>
于 2012-04-30T07:03:25.057 回答
0

然后使用 javascript 进行重定向:

<?php 
    $url = "/index.php";
    echo "<script type='text/javascript'>
            window.location='" . $url . "';
          </script>";
?>
于 2012-04-30T00:53:22.460 回答
0

有时 php 重定向工作得更好/

 header( "Location: index.php" ) ;
 header ("Content-Length: 0");
 exit;
于 2012-04-30T05:24:15.303 回答