JavaScript does not use the browser cache

method one:

href tag linked script src link, or link tag, followed by version number:

<script type='text/javascript' src='//site.com/js.js?v=1.0.0'><\/script>
<link rel="stylesheet" href="index.css?time=20180910">

Method Two:

js generated timestamp:

document.write('<link rel="stylesheet" href="index.css?time='+new Date().getTime()+'">');。

Method three:

css set of meta tags are not cached

<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="0">
<meta http-equiv="Cache" content="no-cache">

 

Guess you like

Origin www.cnblogs.com/liujiale/p/10937618.html
Recommended