gordon.c Posted January 16, 2008 Share Posted January 16, 2008 Hi I have on my sites a login but in some browsers the pages get saved in the cache so the current cookies do not apply... What I need is a piece of code that would prevent loading cached pages. I suppose the refresh would help it but I couldnt find the right code... I have used the javascript: <body onUnload="location.reload(true);"> This one applies only for IE 7 (and lower) and Firefox but does not work at all in Opera 9 (and probably lower too)... Do you have any solutions for this? Or shall I use my php cookies in different way? Thx very much for help... Quote Link to comment https://forums.phpfreaks.com/topic/86338-solved-php-cookies-and-refresh/ Share on other sites More sharing options...
Daniel0 Posted January 16, 2008 Share Posted January 16, 2008 Send these headers: Expires: 0 Cache-Control: must-revalidate, post-check=0, pre-check=0 Pragma: no-cache You can use the header() function for that. Use one header per function call and do it before you output anything. Quote Link to comment https://forums.phpfreaks.com/topic/86338-solved-php-cookies-and-refresh/#findComment-441147 Share on other sites More sharing options...
gordon.c Posted January 16, 2008 Author Share Posted January 16, 2008 Thank you again... Seems to work just well Quote Link to comment https://forums.phpfreaks.com/topic/86338-solved-php-cookies-and-refresh/#findComment-441226 Share on other sites More sharing options...
p2grace Posted January 16, 2008 Share Posted January 16, 2008 Awesome trick, good to know Quote Link to comment https://forums.phpfreaks.com/topic/86338-solved-php-cookies-and-refresh/#findComment-441229 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.