【发布时间】:2011-07-21 18:00:54
【问题描述】:
header("Content-type: text/css"); 适用于 Firefox、Chrome 和其他,但不适用于 Internet Explorer 9。我不确定发生了什么。
在 Chrome 和 Firework 中,如果我在自己的选项卡中打开样式表并将其应用于页面,它会显示样式表。
在开发者工具的网络下的 Chrome 中,它显示类型为text/css,状态为 200。
在 Internet Explorer 9 中,如果我在自己的选项卡中打开样式表并且它没有被应用到页面,它想要下载样式表。
在 F12 开发者工具中,您可以点击网络,开始捕获并刷新页面。它显示Style.css.php。类型为text/html,结果为406。
这是在头脑中:
<link rel="stylesheet" type="text/css" href="/assets/css/style.css.php" media="screen" />
请求标头:
Key Value
Request GET /assets/css/main.css HTTP/1.1
Accept text/css
Referer http://10.0.1.5/
Accept-Language en-US
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Accept-Encoding gzip, deflate
Host 10.0.1.5
Connection Keep-Alive
Cookie PHPSESSID=*Hidden*
响应标头:
Key Value
Response HTTP/1.1 406 Not Acceptable
Date Fri, 01 Apr 2011 10:12:42 GMT
Server Apache/2.2.14 (Ubuntu)
Alternates {"main.css.php" 1 {type application/x-httpd-php}}
Vary negotiate
TCN list
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Content-Type text/html; charset=iso-8859-1
【问题讨论】:
-
“不起作用”是什么意思?有什么问题?
-
它没有正确加载它,就像在 IE 中根本没有加载 css 文件。如果我去文件,它想下载它而不是像 Chrome 和 Firefox 那样显示它。
-
您是否尝试不发送标头? :)
-
是的。 css 文件是一个 php 文件,因为我会检查您想要的工具栏颜色的帐户设置。
-
你试过[Ctrl]+[F5](强制重载)吗?
标签: php http-headers content-type internet-explorer-9