Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to do some simple locally-hosted development using the Ext framework. The site is configured as a virtual directory under IIS 7, so that http://localhost/app points to the index file. The path works fine; the file loads.

Here's my problem: despite the fact that I am not making any changes to the very sizable Ext library javascript files (about 2.4 mb uncompressed), those files are being reloaded every single time I refresh the html file. Even though these files are being served off my local hard drive, each page refresh takes 12 to 13 seconds. This is making testing pretty, um, frustrating.

How can I get unchanged js files to cache? Failing that, why aren't they being loaded more quickly? I'm not downloading them off the internet, I'm moving 2 megs around on my hard drive, which I'm pretty sure should be trivial, time-wise.


share|improve this question
up vote 2 down vote accepted

I'd guess that your delay isn't browser-getting-file-from-localhost-server, it's browser-interpreting-2.4mb-of-javascript. That's a lot of code to parse, and it's going to take more time than simply reading the file off the disk. I'd expect that the browser won't cache a compiled version of the file anyways, so even pulling a cached version would require re-parsing the script.

Your best bet is to optimize the .js file and strip out any functions you don't actually use (or that aren't required by the functions you do use).

share|improve this answer

You need to put some caching directives in your script header or directly at the server level.

At the server level:

IIS7: How to set cache control for static content?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.