I have a question about caching. Consider we have jQuery library in Page1 and has another link to jQuery lib to Page2.
Does page2 use cached version of jQuery in we first request for Page1 then Page2?
Does it depends on Browser? or coding style?
thanks
If the url of the jquery library stays the same then all of the modern browsers will cache that file if it’s on default settings, so on the second and all subsequent requests until it’s expired it will be retrieved from Cache.
That is 1 of the reasons to use a CDN, so that if the user perhaps visited a site that used the same CDN to the javascript file it will be retrieved from cache.
EDIT
As Daniel Kurka mentioned, the response header can state that the file should not be cached, but this should almost never be the case with a jquery file…