开发者

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..开发者_Go百科 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..


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜