gpt4 book ai didi

css - 为什么IE 8可以显示压缩后的CSS,而其他浏览器不能显示?

转载 作者:太空宇宙 更新时间:2023-11-03 19:54:36 28 4
gpt4 key购买 nike

我在 Windows 7 上使用 IIS Web 服务器 7.5 来托管我的元素。我尝试创建可以优化和压缩 Javascript 和 Css 文件大小的 Javascript 和 CSS 处理程序。但是我发现了一些问题。请查看我在 Firefox 3.0.11 浏览器上的 Firebug 上找到的 Test.css 文件的以下请求和响应。

响应 header

Cache-Control : private
Content-Type : text/html
Content-Encoding : gzip
Server : Microsoft-IIS/7.5
X-AspNet-Version : 2.0.50727
X-Powered-By : ASP.NET
Date : Tue, 30 Jun 2009 10:46:15 GMT
Content-Length : 197

请求 header

Host : localhost
User-Agent : Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR
4.0.20506)
Accept : text/css,*/*;q=0.1
Accept-Language : en-us,en;q=0.5
Accept-Encoding : gzip,deflate
Accept-Charset : ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive : 300
Connection : keep-alive
If-Modified-Since : Tue, 30 Jun 2009 10:41:00 GMT
If-None-Match : "1C9F96F41F48600"
Cache-Control : max-age=0

此外,我打开test.css文件的response选项卡,发现CSS文件加载成功。我尝试在 Chrome 3、Safari 4.0、Opera 10.0 等其他浏览器中打开同一页面。但是除了IE 8以外的所有浏览器都无法显示正确的网页。为什么?

body{margin:0;padding:0;background:#f7f7f7 url(Photoes/bg.jpg) no-repeat center top;}

附言。我尝试禁用压缩器,所有浏览器都可以正确显示。

最佳答案

您的响应 header 不正确:

Content-Type : text/html

应该是

Content-Type : text/css

关于css - 为什么IE 8可以显示压缩后的CSS,而其他浏览器不能显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1063118/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com