Firefox 无法通过 HTTPS 加载 CSS 个文件
Firefox fails to load CSS files on HTTPS
你可以在这里看到我的问题:
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>
这很可能是由于 style.css
请求的响应不正确 headers
https://www.rekuperatory.pl/ssltest/style.css was not loaded because
its MIME type, "text/html", is not "text/css".
请注意,当您访问 http://
url 时,服务器会正确响应 Content-Type: text/css
,但是在 https://
url 上它会响应 Content-Type: text/html
.
我不确定为什么人们会找到复杂的解决方案。在我的例子中,我只需要删除缓存文件和 cookie(后来的一个在刷新时大部分被省略)。如果您使用缓存优化,不仅在浏览器中,而且在您的站点中。
你可以在这里看到我的问题: 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>
这很可能是由于 style.css
https://www.rekuperatory.pl/ssltest/style.css was not loaded because its MIME type, "text/html", is not "text/css".
请注意,当您访问 http://
url 时,服务器会正确响应 Content-Type: text/css
,但是在 https://
url 上它会响应 Content-Type: text/html
.
我不确定为什么人们会找到复杂的解决方案。在我的例子中,我只需要删除缓存文件和 cookie(后来的一个在刷新时大部分被省略)。如果您使用缓存优化,不仅在浏览器中,而且在您的站点中。