Browser caching: same remote file name on different sites

I have several different sites on different hosts, and I use the same JS file in all of them, which is downloaded from one and only remote host. For instance,

The single JS name of my.js is stored in someotherhost.net .

This file name is uploaded to several different pages (sites):
somedomain1.net/home.html
somedomain2.net/home.html
somedomain3.net/home.html

View my.js browser caches through these sites . But will he use the same cache for all different sites?

Or maybe it doesn’t matter if the requested file name is the same, stored on one remote host and loaded on different pages, will the browser have different caches?

How does browser caching work?

+3
source share
1 answer

Yes. The browser will cache every unique URL if there are no headers that say this is not.

Your file must have one entry in the browser cache, even if it is requested from several link pages. After caching from one site, the browser will use the cached version for everyone else, which will speed up page loading.

JavaScript CDN ( ). jquery http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js, good, , .

+3

Source: https://habr.com/ru/post/1795418/


All Articles