2

I am using Jquery.js and i want to know does the browser cache the jquery file or this file transfer for each page.

2 Answers 2

7

Caching has nothing to do with a particular file, it's all about the headers for this file.

By default most file will be cached however the duration of the caching depends on the header setting for the file. So yes it should be cached with a default setup.

Here is a little information about caching http://www.web-caching.com/mnot_tutorial/how.html

Sign up to request clarification or add additional context in comments.

1 Comment

correct answer. i would suggest to reference the file via a cdn (content delivery network) if possible. That way, you do not have to consider things like caching and if a user visits your page, he might have already cached that file before on a different page (saving yet another http request) developers.google.com/speed/libraries/devguide
1

It depends on both the server and the client. Once the client has a file, it can use the If-Modified-Since header to tell the server about a cached copy of a file. The server can then respond with a 304 status with optional Last-Modified, Expires and Cache-Control headers, to indicate the status of caching and when the client should request for a new copy. If a cached copy isn't available, the server can respond normally.

You should consider using one of the publicly hosted jQuery files: http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery

These are more likely to be cached on a client.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.