I
I
ince2019-11-08 02:13:19
Browsers
ince, 2019-11-08 02:13:19

Can a browser cache js files passed to it?

Can a browser cache js files passed to it?
Let's say, when requested, it reports to the server the hash of the cache that it has. The server compares the hashes of the cache and js files prepared for sending and either updates them (gives new ones) or reports that there are no changes.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Talyan, 2019-11-08
@ince

So the cache works.
If pragma: no-cache is not received in the header, then it caches

X
xmoonlight, 2019-11-08
@xmoonlight

By default, this is how it works.
But you can make your own caching system in localStorage.
Usually, this is necessary for SPA / PWA single-page applications with complex data processing logic in js and with full control of the network connection status , because correct operation is required in the absence of an Internet connection: offline mode.

S
SagePtr, 2019-11-08
@SagePtr

If you need some complex caching logic, you can try using ServiceWorker

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question