views:

149

answers:

2

I am using jQuery from google CDN.

I looked at the cache-control and it seems the browser should fully cache the jQuery version for a long time.

However when I disable Internet access my webpages stop working. Why? Is it because even though jQuery is cached, the browser still needs to resolve DNS?

+1  A: 

Your brower doesn't need to respect the cache-control header. That is mostly used by proxies. If you want to check whether your browser is keeping a local copy of the script, go into offline mode (in your browser) and try if your website still works.

In addition you might want to enable the Firebug (if you're using Firefox) Net panel to see the exact request your browser sends to the server (and what the response is).

Storm
A: 

There are a few layers of cache. Just because it is cached for a long time doesn't mean it won't ask the server and check to see if it is the latest edition.

Additionally, offline mode in your browser may not even attempt to load files that it determines to be non local.

kinections