Cross origin requests are only supported for protocol schemes

three.js:31853 Failed to load file:///D:/three.js-dev/three.js-dev/examples/fonts/helvetiker_regular.typeface.json: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

使用three.js 添加3D字体的时候遇到上面的问题

原因:

你使用的是本地的file协议,要求的是http, data, chrome, chrome-extension, https这些协议

所以会报错,把这个项目放到tomcat中运行,或者只把你要引用的文件放入tomcat中,然后通过http协议请求就可以了。

猜你喜欢

转载自blog.csdn.net/u013517229/article/details/81353894
今日推荐