zimmo Posted April 12, 2010 Share Posted April 12, 2010 I am having difficulty getting the page cache to not reload content in a form when you hit refresh. I have used the meta tags which do not work well, so I then tried the php code to stop it. The only thing that happens is when you hit the back button it states the page has expired and to do a refresh. When you refresh it loads the information in the form fields that you entered before. I would have thought that it would have given me a blank form again? The php code I am using to stop the caching of the form is: <?php // prevent caching (php) header('Cache-Control: no-cache'); header('Pragma: no-cache'); header('Expires: ' . gmdate(DATE_RFC1123, time()-1)); ?> Any ideas how to stop this? Link to comment https://forums.phpfreaks.com/topic/198277-explorer-and-form-refresh/ Share on other sites More sharing options...
cags Posted April 12, 2010 Share Posted April 12, 2010 What browser are you experiencing this behaviour with? All browsers handle caching etc. slightly differently. If you want to force pages to be a fresh copy when the back button is used one option is to use JavaScript to attach an onunload event. This can be an empty event that does nothing, it's very existence should prevent (at least the big 5 browsers) from caching the page. Since it is JS based and there are no true standards though, there are at least two different methods for attaching the event. The JS boards would be a better place to ask for details on that specific topic though. Link to comment https://forums.phpfreaks.com/topic/198277-explorer-and-form-refresh/#findComment-1040386 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.