JavaScript使瀏覽器不使用緩存


方法一:

script標簽中src鏈接,或者link標簽的href鏈接,后面加上版本號:

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

方法二:

js生成時間戳:

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

方法三:

css的meta標簽設置不緩存

<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">

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM