iwannabeleet Posted January 24, 2008 Share Posted January 24, 2008 I have a cookie script which breaks when Firefox's BACK button is used, as Firefox displays the cached version and the PHP script is not re-run to check/modify the cookie. I solved the problem by adding these headers to force the reload: <?php header("cache-Control: no-store, no-cache, must-revalidate"); header("cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); But I wanted to ask if anyone knows if there is a simpler solution to this? My concern is that these headers will cause Firefox to reload everything, including the media/images on the page (which seems excessive). Is there a better way to solve this problem? Thank you for any advice/suggestions Quote Link to comment https://forums.phpfreaks.com/topic/87469-firefox-back-button-breaks-php-cookie/ Share on other sites More sharing options...
cooldude832 Posted January 24, 2008 Share Posted January 24, 2008 your script should check if cookies are valid on all pages, if the back button is pushed you can't do anything a bout it cause th at is loading a Local copy of the page if headers were sent processor pages should refresh and bounce to the according page (if they have a redirect) so if your processor is built to verify the cookie is set before resetting you should be all set/ Quote Link to comment https://forums.phpfreaks.com/topic/87469-firefox-back-button-breaks-php-cookie/#findComment-447371 Share on other sites More sharing options...
iwannabeleet Posted January 24, 2008 Author Share Posted January 24, 2008 I hadn't thought of it that way but that makes perfect sense, thank you sir~ Quote Link to comment https://forums.phpfreaks.com/topic/87469-firefox-back-button-breaks-php-cookie/#findComment-447379 Share on other sites More sharing options...
cooldude832 Posted January 24, 2008 Share Posted January 24, 2008 gotta remember that a browser is always displaying a local copy that is "cached" after the document is transported from server -> client. The back button in most browsers is defaulted to display the cached data of the "last/back" page. Thus why even if a huge process takes place on the previous page the back button only displays any valid output be it html, xml, txt, jpg etc. Now if that page is refreshed the client is requested new data and thus the processor will reoccur unless you put in some sort of security settings to prevent this so a user can't refresh say adding an event. Quote Link to comment https://forums.phpfreaks.com/topic/87469-firefox-back-button-breaks-php-cookie/#findComment-447383 Share on other sites More sharing options...
cooldude832 Posted January 24, 2008 Share Posted January 24, 2008 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html look at 14.9.4 I know that banks use this for online banking or some varient. Quote Link to comment https://forums.phpfreaks.com/topic/87469-firefox-back-button-breaks-php-cookie/#findComment-447392 Share on other sites More sharing options...
tr309 Posted November 4, 2009 Share Posted November 4, 2009 IE and Safari handle this correctly i.e. they recognise a cookie has been set when Back button is pressed and process accordingly. I've just come across the same problem and immediately checked other browsers to see if it was Firefox et al specific. Guess what? It is. Rich Quote Link to comment https://forums.phpfreaks.com/topic/87469-firefox-back-button-breaks-php-cookie/#findComment-951078 Share on other sites More sharing options...
guttyguppy Posted November 18, 2009 Share Posted November 18, 2009 I'm using the php script above to kill the firefix problem, but I'm still not sure if I'm forcing the reload of all the media on the page. Can someone confirm this either way? Quote Link to comment https://forums.phpfreaks.com/topic/87469-firefox-back-button-breaks-php-cookie/#findComment-959686 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.