Safari Back Button Does Not Exit PHP Exit

I have a logout.php page that ends a user session and works well, and does the following:

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

When testing with Safari, I just noticed that when you log out, you can click the "Back" button to return to the previous page, which requires authentication but is not requested. You cannot go from this page without entering navigation, but it should not display the previous page in the first place.

So far, in my testing, this is only a problem with Safari on Mac OS X, and there are a number of other reports on this, but without the permission that I could find:

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

I would like to disable this behavior using the Safari return button - I was surprised that this happens first.

Thanks Steve

+2
source share
2 answers

Make sure that any page you are authenticating with is sent with the appropriate cache control headers. The page is displayed in the browser’s cache, providing cache controls that explicitly prohibit caching, you should be able to stop this.

From 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 .

http://webkit.org/blog/427/webkit-page-cache-i-the-basics/

http://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/

+2
0

All Articles