MIME类型(“ text / html”)不是有效的JavaScript MIME类型

时间:2019-03-20 08:05:22

标签: javascript opencv

我已经构建了opencv.js,但是将其加载到网页上时,却显示以下错误:

The script from “http://localhost:3000/images/assets/opencv.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.[Learn More] enlarge_image2
Loading failed for the <script> with source “http://localhost:3000/images/assets/opencv.js”. 

加载opencv.js的代码为:

var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'assets/opencv.js';
document.head.appendChild(script);

问题是我无法使用cv.onRuntimeInitialized属性来知道何时正确加载opencv.js。 html网页是在rails上的ruby上实现的。

opencv.js

0 个答案:

没有答案