开发者

How to disable cache in InternetExplorer 8

How can I disable cache in IE8 ? We are doing J开发者_如何学Pythonavascript development and testing it in IE8, but we have to clear the cache every time we make changes to the Javascript files.


Go to Internet Options. On the General tab, under Browsing History click Settings. Select the "Every time I visit the webpage" radio button.

This doesn't "disable" the cache per se, but it should fix your underlying problem - the JS files should be reloaded every time.


Ctrl+F5 Should cause a full page refresh including all that cached javascript.

Occasionally though, you'll still need a cache clear, because even Ctrl+F5 won't work, for reasons beyond comprehension IE can't even get "refresh" right 100% of the time.


If that fails, a random parameter on the query string will do it:

index.html?a=346456


Load you JavaScript this way.

<html>
...
<script type="text/javascript">
document.write('<script src="yourscript.js?'+Math.random()+'"></script>');
</script>
...
</html>

Edit: In case this is not obvious, remove this code as soon you will go into production!


In order to set the browser cache turned off. Follow the instructions below:

MS IE

  1. from a menu select "Tools" for IE5 or "View" for IE4
  2. select "Internet Options"
  3. in "Temporary Internet Files" section click on "Settings"
  4. select "Every visit to the page" for "Check for newer versions of stored pages" save the settings I hope this may help please check


hit "Fn F12" to open developer tools

click Cache

choose "Always refresh from server"

Every time you refresh it should be clearing the cache, but there are also quick access cache clearing from the cache menu or the shortcuts that are active when the dev tools are open.

*Note- you must leave the dev tools window open, it doesn't have to be up front, but it has to remain open for the cache to remain disabled.


Ctrl+Shift+Del will open the Clear Private Data dialog (or select it from the Safety menu). Uncheck everything but the first two items to clear only the cache.

You shouldn't have to clear the cache though. If you access your js files through a web server (such as IIS running locally), the normal cache control mechanisms should do the trick. If they don't, a Ctrl+F5 usually fixes the problem.


If your javascript files are served exclusivley from a sub-directory, you could enable immediate content expiration for that directory in IIS. I recently had this problem serving content from a sub-directory and this was the fastest, simplest solution that I found.


Open the IE debugging tools (F12), Cache on the menu, and select always refresh from server. This does mean you need to keep the debugging tools open.


Maybe a easier way not to have user refresh the browser is just to rename the js files (and css). This is what worked for me... as the server didn't like a random number after the .js file

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜