zoukankan      html  css  js  c++  java
  • HTTP header中的 Cachecontrol

    网页的缓存是由HTTP消息头中的“Cache-control”来控制的,常见的取值有private、no-cache、max-age、must-revalidate等,默认为private。其作用根据不同的重新浏览方式分为以下几种情况:
    (1) 打开新窗口
    如果指定cache-control的值为private、no-cache、must-revalidate,那么打开新窗口访问时都会重新访问服务器。而如果指定了max-age值,那么在此值内的时间里就不会重新访问服务器,例如:
    Cache-control: max-age=5
    表示当访问此网页后的5秒内再次访问不会去服务器
    (2) 在地址栏回车
    如果值为private或must-revalidate(和网上说的不一样),则只有第一次访问时会访问服务器,以后就不再访问。如果值为no-cache,那么每次都会访问。如果值为max-age,则在过期之前不会重复访问。
    (3) 按后退按扭
    如果值为private、must-revalidate、max-age,则不会重访问,而如果为no-cache,则每次都重复访问
    (4) 按刷新按扭
    无论为何值,都会重复访问

    当指定Cache-control值为“no-cache”时,访问此页面不会在Internet临时文件夹留下页面备份。
    另外,通过指定“Expires”值也会影响到缓存。例如,指定Expires值为一个早已过去的时间,那么访问此网时若重复在地址栏按回车,那么每次都会重复访问。

    (对于要求必须进行Authenticate才能访问的敏感页面,可以设置其为no-cache,这样,每次浏览器动作都会要求刷新改页面,在页面表单上填充的内容也不会被保留。)


    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/guoqzhang/archive/2009/05/08/4161280.aspx

  • 相关阅读:
    BEC listen and translation exercise 44
    中译英12
    BEC listen and translation exercise 43
    中译英11
    BEC listen and translation exercise 42
    中译英10
    BEC listen and translation exercise 41
    中译英9
    BEC listen and translation exercise 40
    中译英8
  • 原文地址:https://www.cnblogs.com/smwikipedia/p/1571483.html
Copyright © 2011-2022 走看看