Three workarounds to resolve the problem browser cache

1. Use the meta tag to set caching mechanism

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

2. After references css, js and other files a statement with the version number or different parameters, you can effectively prevent the browser cache has been used in the css, js, then every time a file is loaded with different names

<link href="css/demo.css?v=202003041049" rel="stylesheet">

3. Add the random parameter after the URL, is to identify all the different links to different pages of this web site per visit

window.location='xxx.html?_r='+Math.random();

 

Published 62 original articles · won praise 33 · views 130 000 +

Guess you like

Origin blog.csdn.net/qq_37588752/article/details/104649031