zoukankan      html  css  js  c++  java
  • IE缓存问题

    现象: img src是重新动态生成的图片,但是原来的图片还是在IE缓存中,图片不能改变。但设置“Internet选项-->常规-->Internet临时文件中"设置"-->每次访问此页时检查”,或者“刷新”都可以改变图片的。

    解决:

    禁用客户端缓存  
      HTM网页  
      <META   HTTP-EQUIV="pragma"   CONTENT="no-cache">  
      <META   HTTP-EQUIV="Cache-Control"   CONTENT="no-cache,   must-revalidate">  
      <META   HTTP-EQUIV="expires"   CONTENT="Wed,   26   Feb   1997   08:21:57   GMT">  
      ASP网页  
      <%  
          Response.Expires   =   -1  
          Response.ExpiresAbsolute   =   Now()   -   1  
          Response.cachecontrol   =   "no-cache"  
      %>  
      PHP网页  
      header("Expires:   Mon,   26   Jul   1997   05:00:00   GMT");  
      header("Cache-Control:   no-cache,   must-revalidate");  
      header("Pragma:   no-cache");  
      JSP  
              response.setHeader("Pragma","No-Cache");  
              response.setHeader("Cache-Control","No-Cache");  
              response.setDateHeader("Expires",   0);  
      C#中禁止cache的方法!  
      Response.Buffer=true;  
      Response.ExpiresAbsolute=System.DateTime.Now.AddSeconds(-1);  
      Response.Expires=0;  
      Response.CacheControl="no-cache";  

    或者

    在<%@   Page   language="c#"   Codebehind="A.aspx.cs"   AutoEventWireup="false"   Inherits="*.*"   %>下面加上以下的代码:  
      <%@   OutPutCache   Location="None"%>    能每次页面Load时都可以清空缓存

  • 相关阅读:
    Css实现漂亮的滚动条样式
    清除浮动的方式有哪些?比较好的是哪一种?
    Cookie、sessionStorage、localStorage的区别
    http和https的区别?
    git 拉取分支切换分支
    css 三角形
    js中??和?.的意思
    js this指向
    tsconfig.json配置
    查看本地安装的所有npm包
  • 原文地址:https://www.cnblogs.com/roamman/p/1382765.html
Copyright © 2011-2022 走看看