Question

I have a javascript galleria which does work in every modern browser, even in IE7. But in IE8 if its load.. it does not show the gallery.. BUT if I press Ctrl + F5 it does a hard reload, it erase the cache and finally the galleria appears.. If I just reload the page.. or if I go to another page with the same galleria script, the problem comes again.. so I need a hard reload script for IE8.

Pseudo Code:

On Document Load

If user agent IE8 {
erase website cache
}

do normally continue webpage loading..
Was it helpful?

Solution

The problem isn't on the client side. The problem is your server. IE will aggressively cache responses to AJAX requests unless the server sets a Cache-Control: no-cache in the response. Clearing the cache in the browser is the wrong fix, because the server should decide what is current and what is not.

So change the server response to your request to include the correct headers.

OTHER TIPS

see that link about clearing the cache! Clear all website cache?

One possible way to fake a clear cache would be to attach a cache buster to all resources from a page your resources like

"test.js?cacheBuster=" + new Date())

This should be a last resort.

Using javascript you won't be able to do this. What you can do is to write code in your server side language so that the entire page won't be cached.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top