Windows 7上的IE11不缓存文件 [英] IE11 on Windows 7 does not cache files

查看:165
本文介绍了Windows 7上的IE11不缓存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当检查我们网站上的缓存行为时,我得到一个非常令人困惑的结果-我的Internet Explorer 11浏览器根本没有缓存任何文件。 Internet选项中的缓存设置设置为自动检查存储的页面的较新版本:。

When examining cache behaviour on our web site I got a very confusing result - my Internet Explorer 11 browser did not cache any files at all. The cache settings in the Internet Option is set to "Check for newer versions of stored pages: Automatically".

使用IE开发人员工具进行进一步调查,所有文件的请求都没有 if-modified-since HTTP标头,这当然会使服务器返回状态值为200的完整文件。预期的行为是IE应该发送 if-modified-since标头,然后服务器以304(未修改)状态响应,告诉浏览器使用缓存的副本。

Investigating further with IE developer tool, all files were requested without an "if-modified-since" HTTP header, which of course caused the server to return the complete file with a 200 status result. Expected behaviour would be that IE should send an "if-modified-since" header, and the server then responding with a 304 (Not modified) status telling the browser to use the cached copy.

我尝试过的所有网站都发生相同的行为。

The same behavior occurs for all web sites I have tried.

然后我使用browserstack.com在Windows 7计算机上打开了远程IE11。 。结果相同,没有文件被缓存。但是,在Windows 8.1计算机上,IE11缓存文件并发送 if-modified-since标头,导致304个响应。

I then used browserstack.com to open up a remote IE11 on a Windows 7-machine. Same result, no files are cached. However, on a Windows 8.1 machine, IE11 caches the files and sends a "if-modified-since" header, causing in 304 responses.

我包括示例请求和响应标头:

I include example request and response headers:

来自Windows 7 / IE11的请求:

Request:GET /EdUwb.png HTTP/1.1
Accept:image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5
Referer:http://stackoverflow.com/
Accept-Language:sv-SE
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding:gzip, deflate
Host:i.stack.imgur.com
Connection:Keep-Alive

来自Windows 7 / IE11的响应:

Response:HTTP/1.1 200 OK
Date:Wed, 05 Aug 2015 14:30:43 GMT
Content-Type:image/png
Content-Length:3635
Connection:keep-alive
Set-Cookie:__cfduid=dfbb24e8f5badb07e8f2bbd969590320b1438785043; expires=Thu, 04-Aug-16 14:30:43 GMT; path=/; domain=.imgur.com; HttpOnly
Cache-Control:public, max-age=315360000
ETag:"c5d00c1be2583713eca1d0ad1efdb914"
Expires:Sat, 02 Aug 2025 14:30:43 GMT
Last-Modified:Thu, 02 Apr 2015 19:36:41 GMT
x-amz-version-id:Rmrsr2WfDsdFppBa_Ju10BC3Y52.bglA
CF-Cache-Status:HIT
Vary:Accept-Encoding
Server:cloudflare-nginx
CF-RAY:2113339ae74b0a48-ARN

请求Windows 8.1 / IE11:

Request:GET /EdUwb.png HTTP/1.1
Accept:image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5
Referer:http://stackoverflow.com/
Accept-Language:en-US
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding:gzip, deflate
Host:i.stack.imgur.com
If-Modified-Since:Thu, 02 Apr 2015 19:36:41 GMT
If-None-Match:"c5d00c1be2583713eca1d0ad1efdb914"
Connection:Keep-Alive

来自Windows 8.1 / IE11的响应:

Response:HTTP/1.1 304 Not Modified
Content-Type:image/png
Content-Length:3635
ETag:"c5d00c1be2583713eca1d0ad1efdb914"
x-amz-version-id:Rmrsr2WfDsdFppBa_Ju10BC3Y52.bglA
CF-Cache-Status:HIT
Vary:Accept-Encoding
CF-RAY:21133083e7920c5f-AMS
Expires:Sat, 02 Aug 2025 14:28:19 GMT
Last-Modified:Thu, 02 Apr 2015 19:36:41 GMT

有人知道为什么Windows 7上不缓存文件吗?

Has anyone got an idea why the file is not cached on Windows 7?

推荐答案

IE11 devtools具有默认情况下处于启用状态的始终从服务器刷新选项。您必须关闭此功能才能观看devtools中的缓存。

IE11 devtools has a "Always refresh from server" option that is on by default. You have to turn this off to be able to watch caching happen in the devtools.

这篇关于Windows 7上的IE11不缓存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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