Why is the browser slow to load the page the first time and much faster the second time?

when loading a page, browsers sometimes wait for 1-2s, but after loading successfully, re-reload the page, then < 1s can be loaded. What does the browser do at this time

May.17,2022

the first time you load, all resources need to be loaded from the server. When
loads for the second time, resources such as css,js are fetched directly from the cache because the browser has a cache.
you can open the console and observe the contents of network


you need to learn about http caching
clipboard.png


""network

:

  1. service work
  2. memory cache
  3. disk cache
  4. push cache

status: 200

1

:
http headerexpires



http/1.1 last-modified
http/1.1 EtagEtag

status:304 Not-Modified


you can move to https://codeshelper.com/a/11... to see about the front-end browser cache


the browser has a caching mechanism

Menu