Apache提供CSS和JS文件,但浏览器不提供它们

一个网页由apache2,CentOS 6.2托pipe。

它获取HTML,CSS,JS文件确定到客户端。 但CSS和JS不渲染,可以发生什么? 由于他们应该在客户端运行100%…

MIMEtypes可能是错误的。

检查他们正在使用Content-type: text/javascriptContent-type: text/css 。 您可以使用Chrome的Inspector或Firebug的“networking”选项卡进行检查。

你需要mod_mime ,并确保你的httpd.conf有这些行:

 AddType text/css .css AddType text/javascript .js 

这应该做到这一点。