views:

1114

answers:

6

How can I disable cache in IE8 ? We are doing Javascript development and testing it in IE8, but we have to clear the cache every time we make changes to the Javascript files.

A: 

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.

Nick Craver
hm this is quite dangerous for development then..
portoalet
A: 

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

index.html?a=346456

+1  A: 

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.

Evgeny
Will this work 100% of the time?
portoalet
That's not something I can guarantee, you'll just have to test it.
Evgeny
A: 

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.

josh3736
The problem is that in production we want the browser to use the cache as the javascripts are massive. Which cache control mechanism are you talking about?
portoalet
I was talking about development and testing. HTTP's `Last-Modified`, `If-Modified-Since`, and `ETag` headers let the browser and server figure out whether a file has been modified, and if it has, update the browser's cached version.
josh3736
A: 

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
harigm
A: 

Load you JavaScript this way.

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