Two Simple Rules for HTTP Caching

  1. Don’t cache HTML
    • Use Cache-Control: no-cache for dynamic HTML pages
    • Use the Last-Modified header with the current file time for static HTML
  2. Cache everything else forever
    • For all other file types set an Expires header to the maximum future date your web server will allow
  3. Modify URLs by appending a query string in your HTML to any page element you wish to ‘expire’ immediately.

 

     Two Simple Rules for HTTP Caching

 

     给静态内容设置cache的方法

 

 

 

     为了确保IE与Firefox的缓存 行为一致,你应该:

  • 总是指定一个Expires头. 一般设置-1使用html页面能即时刷新或者对其它如图片,CSS,javascript脚本资源设置一个特定的过期时间
  • 如果你要强制页面刷新,甚至是点击后台按钮的时候,那就设置 Cache-Control: no-cache, no-store

   Firefox与IE浏览器缓存的两个重要区别

你可能感兴趣的:(JavaScript,cache,css,IE,firefox)