Will Posted October 27, 2007 Share Posted October 27, 2007 Just thought I'll share this with you because it took me ages to realize why it happened. I was using AJAX to do some form stuff when the use clicked a button, but it only worked the first time I spent ages thinking it was me but then I found an article on the Internet saying the IE caches the pages. To fix this just put this at the end of the URL you are calling in the javascript: + "&ms=" + new Date().getTime(); I'm sure you can guess that this makes the URL different every time so IE can't cache it. Quote Link to comment Share on other sites More sharing options...
CtrlFreq Posted February 25, 2009 Share Posted February 25, 2009 Re: How to fix IE Caching AJAX pages. The following block of headers, placed in any dynamic page before a response has been sent to the user, will give you the same effect without messing with your query strings (the first two help with SEO as well). header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified header ('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header ('Pragma: no-cache'); // HTTP/1.0 Quote Link to comment Share on other sites More sharing options...
CtrlFreq Posted February 25, 2009 Share Posted February 25, 2009 Re: How to fix IE Caching AJAX pages. [double post] Quote Link to comment 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.