JavaScript使瀏覽器不使用緩存

方法一:javascript

script標籤中src連接,或者link標籤的href連接,後面加上版本號:css

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

方法二:java

js生成時間戳:緩存

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

方法三:ui

css的meta標籤設置不緩存spa

<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">
相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息