Detecting browser cache by jQuery

后端 未结 3 1840
粉色の甜心
粉色の甜心 2021-01-12 01:20

Is there a jQuery approach to detect whether a page is loaded from the browser cache OR it has been received from the server by HTTP request?

3条回答
  •  北海茫月
    2021-01-12 02:12

    You could also use Navigation Timing to measure the network latency in great detail.

    Here is a good article: http://www.html5rocks.com/en/tutorials/webperformance/basics/

    If the time difference between fetchStart and responseStart is very low, the page was loaded from cache, for example.

提交回复
热议问题