Safari浏览器后退按钮没有履行PHP注销会话 [英] Safari Back button not honouring PHP logout session

查看:122
本文介绍了Safari浏览器后退按钮没有履行PHP注销会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有哪些结束用户会话和运作良好,并做如下的logout.php页:

I've got a logout.php page which ends a user's session and works well and does the following:

在session_start();
session_unset();
session_destroy();

session_start(); session_unset(); session_destroy();

Safari浏览器测试用户注销时您可以点击后退按钮返回到需要身份验证,但不会提示previous页面的时候,我只注意到。你不能从这个页面进行浏览,而无需进入导航,但它不应该摆在首位来显示previous页。

I've just noticed when testing with Safari that when you logout you can click the back button to return to the previous page which requires authentication but are not prompted. You cannot navigate away from this page without entering the navigation but it should not be displaying the previous page in the first place.

所以,在我的测试到目前为止这只是使用Safari在Mac OS X上的问题,有许多关于这一点,但没有解决,我能找到其他报告:

So far in my testing this is only an issue with Safari on Mac OS X and there are a number of other reports about this but with no resolution that I could find:

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23702691.html

我希望能够禁用此行为与Safari浏览器的后退按钮 - 惊讶,这是摆在首位发生

I would love to be able to disable this behaviour with Safari's back button - surprised that this is happening in the first place.

谢谢,
史蒂夫

Thanks, Steve

推荐答案

确保您服务需要身份验证的页面被用合适的缓存控制头发送。正在从浏览器缓存中显示的页面,通过提供明确禁止缓存,你应该能够阻止这种缓存控制。

Ensure that any page you serve which requires authentication is being sent with suitable cache control headers. The page is being displayed from the browser cache, by providing cache control which explicitly forbids caching you should be able to stop this.

http://php.net/manual/en/function.header.php

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

专为Safari浏览器,有大约缓存一些讨论和卸载事件,您可能能够使用以避免缓存。看来,WebKit的确实有一定的并发症与一般的缓存。

Specifically for Safari, there's some discussion about caches and unload events, which you might be able to use to avoid caching. It seems that WebKit does have some complications with caching in general.

http://webkit.org/blog/427 / WebKit的页面缓存我最基础/

http://webkit.org/blog / 516 / WebKit的页面缓存-II最卸载事件/

这篇关于Safari浏览器后退按钮没有履行PHP注销会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆