JavaScript 异常:Firefox 浏览器上 "not well-formed" 和 chrome 浏览器上 "XMLHttpRequest.." 错误

JavaScript exception: "not well-formed" on firefox browser and "XMLHttpRequest.." error on chrome browser

我正在学习three.js。我已将对象的 .obj 文件转换为 .js 文件,并使用 JSONLoader 加载该对象。它显示在 Firefox 浏览器上。但它在控制台中显示 javascript 异常如下:

not well-formed Porsche_911_GT2.js:1:1 

我在 chrome 浏览器上 运行 使用的代码相同。但是没有显示对象。在控制台中有如下错误:

 XMLHttpRequest cannot load file:///C:/Users/inwindow/Desktop/webGL/myTHREE.js/obj/car/Porsche_911_GT2.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.     three.min.js:263

THREE.JSONLoader: "obj/car/Porsche_911_GT2.js" seems to be unreachable or the file is empty.                                                three.min.js:262 

 Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///C:/Users/inwindow/Desktop/webGL/myTHREE.js/obj/car/Porsche_911_GT2.js'.  three.min.js:263

为什么会这样?有人可以帮我吗?

将 Porsche_911_GT2.js 的 url 相对于本地服务器提供给 JSONLoader。 它不适用于文件协议... 它应该在服务器上并且可以通过 http 或 https 协议访问。