Firefox无法在HTTPS上加载CSS文件

时间:2015-03-12 07:14:05

标签: html css firefox ssl

你可以在这里看到我的问题: https://www.rekuperatory.pl/ssltest/

使用 Firefox 打开此网站时,无法加载CSS。问题是,CSS在Chrome,IE和Opera中正确加载。 FF也正确读取内联样式。

通过HTTP访问网站时没有问题: http://www.rekuperatory.pl/ssltest/ - 它可以在包括Firefox在内的每个浏览器上加载。

问题仅在于Firefox的问题,只能通过HTTPS进行,并且只能在单独的文件中使用CSS。

我已与托管服务提供商联系,他们说,SSL证书一切正常,问题必须在于链接CSS文件。但我不认为这是真的。只需看看代码:



h1{
  color: #2387ff;
  font-size: 50px;
  text-align: center;
  background-color: #F0F8FF;
}
.hide{
  display: none;
}

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="style.css"/>
</head>
<body>

<h1>
    This should be blue and centered
</h1>

<div class="hide">CSS NOT LOADED* <br/> <small>*This DIV has "display: none" rule</small>
</div>

<h2 style="  color: #499249; text-align: center; background-color: #e6ffe3;">
    Header with inline style.
</h2>

</body>
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:4)

这很可能是由于style.css

请求的响应标头不正确
  

https://www.rekuperatory.pl/ssltest/style.css未加载,因为   它的MIME类型&#34; text / html&#34;,不是&#34; text / css&#34;。

请注意,当您访问http://网址时,服务器正在使用Content-Type: text/css正确回复,但是在https://网址上,它会以Content-Type: text/html回复。