美文网首页
清除浏览器缓存

清除浏览器缓存

作者: 宏_4491 | 来源:发表于2020-07-20 11:20 被阅读0次

在开发的过程中,往往会遇到浏览器的缓存问题.就是清除浏览器的缓存才能看到最新的内容

解决方案

  • 方法一: 在html 的head上面加以下的代码
   <!-- 清理缓存 -->
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
    <meta http-equiv="expires" content="0" />
  • 方法二 : 引入的文件后面加上时间畿
    <script>
      document.write(
        '<link rel="stylesheet" href="../css/base.css?' + Math.random() + '">'
      )
    </script>
    <script>
      document.write(
        '<script src="../js/companyNews.js?' + Math.random() + '"><\/script>'
      )
    </script>
//在后面写死一个时间戳
<link rel="stylesheet" href="resources/css/xadmin.css?20190909>

相关文章

网友评论

      本文标题:清除浏览器缓存

      本文链接:https://www.haomeiwen.com/subject/zwyekktx.html