【问题标题】:clear url caching when it is loaded in iframe在 iframe 中加载时清除 url 缓存
【发布时间】:2012-01-10 16:56:20
【问题描述】:

我正在 iframe 中加载 url 内容。所以现在 url 信息会自动下载到用户临时文件夹中。 我已经使用了以下代码:

<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">

如何避免所有浏览器的缓存? 在 iframe 中加载时如何避免 url 缓存?

需要你的建议与示例..

【问题讨论】:

标签: c# javascript asp.net browser


【解决方案1】:

no-cache 指令使浏览器在每次页面加载时都请求内容。这与阻止下载不是一回事。

听起来您不是在尝试避免缓存,而是在尝试避免将下载的文件保存到本地文件系统。 no-store 是您发现的完成此操作的方法,但这并不意味着浏览器无法存储,而是必须“尽最大努力”避免将文件存储在非易失性存储中。

我不知道是否有任何浏览器在不临时存储文件的情况下支持此功能 - 我找不到任何支持图表。

【讨论】:

    【解决方案2】:
    // Stop Caching in IE
    Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
    
    // Stop Caching in Firefox
    Response.Cache.SetNoStore();
    

    这些语句添加了以下响应标头:

    缓存控制:无缓存,无存储 Pragma: 无缓存

    也读过这个我在asp.net论坛上找到的:

    Use the following tags inside head tag of your page.
    
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    
    Both the above tags should be included if you are not sure if server is HTTP/1.1 compliant. Also Include:-
    
    <META HTTP-EQUIV="EXPIRES" 
    CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">  tells the server which cache the page to expire the page in given time interval. An invalid interval like "0" or "-1" expires it immediately and causes a fetch of latest version of file, each time request is made.
    
    you can get complete info at this link :- http://www.i18nguy.com/markup/metatags.html
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-20
      • 1970-01-01
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多