【问题标题】:Resource interpreted as Script but transferred with MIME type text/html javascript资源解释为脚本,但使用 MIME 类型 text/html javascript 传输
【发布时间】:2014-07-15 13:57:05
【问题描述】:

在我的 html 文档中包含 AngularJS/javascript 时遇到问题。每次我加载我的 index.html 时都会出现这个错误:

Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:8888/assets/angular/1.2.9/angular-route.js". index.html:17
Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:8888/assets/angular/1.2.9/angular.js". 

这是我的脚本标签:

<script src="./assets/angular/1.2.9/angular.js"></script>
<script src="./assets/angular/1.2.9/angular-route.js"></script>

到目前为止我所尝试的:

包括&lt;?php Header("Content-Type: application/x-javascript; charset=UTF-8"); ?&gt;, 定义脚本标签 text/javascript 是或 application/javascript

希望你们能帮我解决这个问题。

【问题讨论】:

    标签: javascript html


    【解决方案1】:

    尝试将type="text/javascript" 放在你的脚本标签中

    【讨论】:

    • 我唯一能想到的另一件事是检查脚本文件是否实际包含预期的 javascript 而不是其他内容。尝试使用 Angualr cdn 来排除本地文件的问题。
    猜你喜欢
    • 2011-07-18
    • 2014-07-12
    • 2014-12-01
    • 2012-06-18
    • 2012-11-23
    • 1970-01-01
    • 1970-01-01
    • 2013-08-03
    • 2014-10-16
    相关资源
    最近更新 更多