【发布时间】:2016-09-08 21:38:39
【问题描述】:
当我在 localhost 上运行我的应用程序时,我收到 2 条关于 MIME 类型的警告。这是其中之一:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3000/BootstrapEssentials/bootstrap.css".
另一个警告与不同的文件相同。这两个文件都在我的工作目录中。到目前为止,我遇到过这些类似的问题,但它们没有帮助:
Chrome says "Resource interpreted as script but transferred with MIME type text/plain.", what gives?
Resource interpreted as stylesheet but transferred with MIME type text/html
最初我试图使用这一行:
<link rel="stylesheet" href="/BootstrapEssentials/bootstrap.css">
我已经在类型字段中添加了:
<link rel="stylesheet" href="/BootstrapEssentials/bootstrap.css" type="text/css">
但这并没有做任何事情。我还使用 JavaScript 控制台看到它在响应标头中具有 content-type: text/html; charset=utf-8,我相信如果我可以将其更改为 content-type: text/css; charset=utf-8,那么一切都会好起来的,但我也找不到如何做到这一点。
【问题讨论】:
-
BootstrapEssentials 文件夹是否位于名为 public 的目录中?
-
@sheeldotme 不,应该是吗?我目前将它放在我的 client.js 文件旁边的 clients 文件夹中。