Welcome Guest, Not a member yet? Register   Sign In
Browser cache displays old flash data
#1

[eluser]txomin[/eluser]
As the title says. Flash data and field error messages are still displayed when I revisit a page, for example, the login page. Pressing F5 forces a refresh of the page, bypassing the cache by requesting the page from the server, and everything is loaded fine.

Based on another post, it seems I could do something like this...

Code:
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

... somewhere in my code (don't know where, to be honest). It seems overkill to do this for every page.

To make matters worse, when the user enters data, sometimes the browser does not display the updated information and, rather, shows an old display page.

How do you guys handle the problem of the browser cache?
#2

[eluser]Clooner[/eluser]
You can also set caching behaviors for files and html pages using the .htaccess and filesmatch directive which is I believe a more commonly used way.
#3

[eluser]txomin[/eluser]
Very interesting. Had no idea.

Thank you.
#4

[eluser]txomin[/eluser]
On the use of .htaccess in order to prevent pages from being cached, if found:

Code:
<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>

The thing is, what extension are CI files? Requests for pages do not have php extensions...
#5

[eluser]Clooner[/eluser]
[quote author="txomin" date="1238299029"]On the use of .htaccess in order to prevent pages from being cached, if found:

Code:
<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>

The thing is, what extension are CI files? Requests for pages do not have php extensions...[/quote]

It is always loading the index.php file in the root.
#6

[eluser]txomin[/eluser]
Very good point.




Theme © iAndrew 2016 - Forum software by © MyBB