Search code examples
javascriptinternet-explorer-8loadingcache-control

IE7 does it well but IE8 does not load the javascript gallery script - whats wrong?


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..

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.