zoukankan      html  css  js  c++  java
  • 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">
  • 相关阅读:
    lc739
    POJ3280
    6.2
    5.30
    5.28
    5.26
    5.26
    5.25
    从0搭建vue项目
    docker安装jenkins并使用
  • 原文地址:https://www.cnblogs.com/liujiale/p/10937618.html
Copyright © 2011-2022 走看看