Welcome Guest, Not a member yet? Register   Sign In
Cache problem for safari browser

Hello Team,

I am working with CI 1.7.3 version i face one problem when i logout from my site and use the browser back button so its show me the previous page from where i logout from site....

I resolved this problem using cache clear as



protected function no_cache(){
                header('Cache-Control: no-store, no-cache, must-revalidate');
                header('Cache-Control: post-check=0, pre-check=0',false);
                header('Pragma: no-cache');

And its work fine for the some of broswer as Firefox chrome etc....but i still face the problem for safari browser its still show me the previous page rather that redirect to login page.

So please suggest me any solution for this if any ....Thanks in Advance...

From what I have found is that there seems to be a bug in the way that safari caches pages!

You can try this but it may not work!
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");


Yes i tried this but still i face the same problem..........

Which code i used that's work for only firefox and chrome browser but its not work for safari broswer...

so please suggest any other way or is safari not support to this..


You search using google, but like I said safari has problem clearing it's cache!


hi InsiteFX

So you mean to say there is no any way clear the cache for safari browser.....its browser issue...

No that I could find searching for it, but I did read that the next update was to fix the problem. Yet to be seen!

I think wordpress has away of doing it but you would need to dig through the wordpress code. I have wordpress installed on my localhost give me a little time and I' ll search through the code and see if I can find how they are handling it.


Ok I have done some more research on this so give these a try!
// .htaccess
<IfModule mod_headers.c>
  Header set Cache-Control "public"
  <FilesMatch "\.php$">
      Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"

// PHP Version.
header('Expires: Wed 11 Jan 1984 05:00:00 GMT');
header('Last-Modified: 'gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-stor, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0');
header('Pragma: no-cache');

// Header test function. Run right after setting headers!
if (headers_sent())
    echo '<h1>Headers sent</h1>';
    echo '<h1>Headers not sent</h1>';

echo '<pre>';
echo '</pre>';
Do not use META cache control!


Thanks for your comment Insite...

I have rearranged the code as per you provide and make all changes. but still i face the same problem on safari browser..as i see when i logged in site the site set two cookies variable and after logged out only one cokkie variable destroy one is till there and if i use the browser back button then that another cookie variable get destroy and redirect to login page...this happened only for firefox,chrome,,,but In safari it should not destroy the cookie is still there..

Please suggest me any other solution for this...

Thanks in advance...

Form what I read the bug is in the webkit that the browsers use.

Banks get around this bug so my guest is that it has something to do with https://
Because the banks use https://



I met this issue on MAC OS 10.7.5 safari 6.0.5 and only MAC client safari.

Did this issue have any solution or disappear at new safari version?


Theme © iAndrew 2016 - Forum software by © MyBB