我在堆栈溢出上发布了这个,但有人建议我在这里可能会有更多的运气:
我之前没有使用 deflate 对网页进行编码,所以这对我来说是新的领域,但是当我查看 ff 中的网络流量时,我的 all.js 文件现在从 427kb 变为 117kb,所以我似乎可以在这里使用它。但是在IE9中没有变化。我的响应头说 Content-Encoding: gzip in FF but not IE9
这是我的.htaccess:
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>
Run Code Online (Sandbox Code Playgroud)
IE9 中 all.js 的请求头:
Key Value
Request GET /all.js HTTP/1.1
Accept application/javascript, */*;q=0.8
Referer http://www.alexchapman.co.uk/
Accept-Language en-GB
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Accept-Encoding gzip, deflate
Host static.alexchapman.co.uk
Connection Keep-Alive
Cache-Control no-cache
Run Code Online (Sandbox Code Playgroud)
IE9 中 all.js 的响应头:
Key Value
Response HTTP/1.1 200 OK
Date …Run Code Online (Sandbox Code Playgroud)