S
S
Stepan0072022-03-28 16:26:41
Browsers
Stepan007, 2022-03-28 16:26:41

How do browsers deal with 10 identical requests to a static file?

There is a function in JS in which the request lies. import('config.min.js')
If we run it 10 times in a row through forEach for each element (there are 10 of them), we will have 10 requests to the server or 1 request to the server, and the browser will leave 9 requests to the cache after the first one, when will he wait?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hx510b, 2022-03-31
@hx510b

The behavior depends on the server response.
If the server tells the browser that the files can be cached. Those. the other 9 downloads will be made from the browser's local cache.
If the server reports that the file cannot be cached, then the browser should request it again.
In addition to caching on the browser side, an intermediate proxy server, if any, can cache. A proxy server can be used explicitly by the browser, or it can be used implicitly on the network.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question