Zemzela
Zemzela

Reputation: 3080

Caching the java script by browser

I'm wandering how does browser caches the javascript files. I have utility.js and I use it on multiple pages. I know that when I go to www.some_host/page1.html the utility.js is cached for that request. What happens if I go to different page www.some_host/page2.html, utility.js is requested again from server or take it from browser cache?

Upvotes: 0

Views: 118

Answers (2)

ziu
ziu

Reputation: 2720

The browser normally follows the caching rules employed for the other resources (pages, images etc...)

Upvotes: 1

Quentin
Quentin

Reputation: 943100

Everything is cached based on its own URI. It doesn't matter what caused the browser to load it (unless you have something like Vary: referer in the headers, which I've never seen)

Upvotes: 1

Related Questions