我已经构建了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上实现的。