Reputation: 123
I have a status page that needs to be constantly refreshed. It makes ajax calls to a Java server and gets the updated statuses. It works perfectly in Chrome, but in IE11 it is not refreshing when I click refresh. However, when I open the dev tools, it does work. As soon as I close dev tools, it stops working. I have the following meta tags in my head:
<meta http-equiv="cache-control" content="no-cache, must-revalidate, post-check=0, pre-check=0">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
And it won't be enough to set my own browser to not use caching; I need it to work for users without them having to change their browser settings.
Upvotes: 0
Views: 955
Reputation: 123
I found a solution: Apparently, IE caches ajax calls, so that needs to be disabled. Adding 'cache: false' to the ajax call fixes the issue:
$.ajax({
url: www.url.com,
cache: false
})
Upvotes: 0
Reputation: 101
According to this, https://support.microsoft.com/en-us/kb/234067, there is a bug in IE around this. https://support.microsoft.com/en-us/kb/222064 explains it. Maybe you're hitting that? I would also say you should make sure your meta tags are at the top of the head section.
Alternatively, I think the best solution would be to use HTTP headers. I've had very good results with cache HTTP headers.
Upvotes: 2