Roger
Roger

Reputation: 3959

jQuery hosted on Google CDN: why is Internet access still needed?

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?

Upvotes: 3

Views: 255

Answers (2)

user108073
user108073

Reputation:

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.

Upvotes: 0

shartte
shartte

Reputation: 756

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).

Upvotes: 1

Related Questions