标题(“Content-type:text / css”);正在使用Firefox和Chrome,但在Internet Explorer 9中它显示为“text / html” [英] header("Content-type: text/css"); is working in Firefox and Chrome, but in Internet Explorer 9 it shows up as 'text/html'

查看:207
本文介绍了标题(“Content-type:text / css”);正在使用Firefox和Chrome,但在Internet Explorer 9中它显示为“text / html”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

header(Content-type:text / css); 适用于Firefox,Chrome等,但不适用于Internet 资源管理器  9。我不确定是什么。

header("Content-type: text/css"); works in Firefox, Chrome and other, but not in Internet Explorer 9. I am not sure what's up.

在Chrome和Firework中,如果我在自己的标签页中打开它并将其应用到页面,它会显示样式表。

In Chrome and Firework it shows the style sheet if I open it in its own tab and it's being applied to the page.

在开发者工具的网络下的Chrome中,它表示类型为 text / css ,状态为200。

In Chrome under Network in the developer tools it says the type is text/css and the status is 200.

在Internet  Explorer  9中,如果我在自己的标签页中打开它并且它没有应用到页面,它想要下载样式表。

In Internet Explorer 9, it wants to download the style sheet if I open it in its own tab and it's not being applied to the page.

在F12开发人员工具中,您可以单击网络,开始捕获并刷新页面。它显示 Style.css.php 。类型是 text / html ,结果是406。

In the F12 developer tools you can click on network, start capturing and refresh the page. It shows the Style.css.php. The type is text/html and the result is 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有< a href =http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx>不,我不是在开玩笑关于内容类型开关:

X-Content-Type-Options: nosniff

BTW:确保你也发送 Last-Modified 并禁用<$ PHP中的c $ c> session.cache_limiter ,否则浏览器将继续重新加载CSS文件,这将对性能产生负面影响。

BTW: make sure you also send Last-Modified and disable session.cache_limiter in PHP, otherwise browsers will keep reloading the CSS file, which will negatively impact performance.

这篇关于标题(“Content-type:text / css”);正在使用Firefox和Chrome,但在Internet Explorer 9中它显示为“text / html”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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