Chrome不会缓存图片/ js / css [英] Chrome doesn't cache images/js/css

查看:345
本文介绍了Chrome不会缓存图片/ js / css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Chrome加载我的网站时,它会在显示文件之前检查服务器是否有更新版本的文件。 (图片/ Javascript / CSS)它从服务器获取304,因为我从不编辑外部JavaScript,CSS或图像。



我想要的是显示图像甚至没有检查服务器。



以下是标题:

  Connection:keep-alive 
日期:2010年8月3日星期二21:39:32 GMT
ETag:2792c73-b1-48cd0909d96ed
过期时间:星期四,2010年09月02日21点39分:32 GMT
服务器:Apache / Nginx / Varnish

如何使其无法检查服务器?

解决方案



Chrome会在请求的Cache-Control标头中设置max-age:0 如果你在地址栏中按回车键。如果您使用超级链接访问您的页面,则应按预期使用缓存。


When Chrome loads my website, it checks the server for updated versions of files before it shows them. (Images/Javascript/CSS) It gets a 304 from the server because I never edit external javascript, css or images.

What I want it to do, is display the images without even checking the server.

Here are the headers:

Connection:keep-alive    
Date:Tue, 03 Aug 2010 21:39:32 GMT    
ETag:"2792c73-b1-48cd0909d96ed"    
Expires:Thu, 02 Sep 2010 21:39:32 GMT    
Server:Apache/Nginx/Varnish

How do I make it not check the server?

解决方案

What do your request headers look like?

Chrome will set max-age:0 on the request's Cache-Control header if you press Enter in the location bar. If you visit your page using a hyperlink, it should use the cache, as expected.

这篇关于Chrome不会缓存图片/ js / css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆