admin管理员组文章数量:1323194
I'm using THREE.js and I get this error in the developer console:
Cross-origin image load denied by Cross-Origin Resource Sharing policy.
when I open my script with Chrome. The code looks like this:
var particle_system_material = new THREE.ParticleSystemMaterial({
color: 0xffffff,
map: THREE.ImageUtils.loadTexture("images/circle.png"),
});
So as you can guess, the:
map: THREE.ImageUtils.loadTexture("images/circle.png");
is the problem. With Firefox it works very well.
I've read the tips in the following links : Chrome, three.js: Cross-origin image load denied, .js/wiki/How-to-run-things-locally,
I also realized the mands given:
Start Chrome executable with a mand line flag:
chrome --allow-file-access-from-files
nothing works and I'm going crazy. It is just an image on my hard drive with HTML and JS files, no server, no "origin".
I'm using THREE.js and I get this error in the developer console:
Cross-origin image load denied by Cross-Origin Resource Sharing policy.
when I open my script with Chrome. The code looks like this:
var particle_system_material = new THREE.ParticleSystemMaterial({
color: 0xffffff,
map: THREE.ImageUtils.loadTexture("images/circle.png"),
});
So as you can guess, the:
map: THREE.ImageUtils.loadTexture("images/circle.png");
is the problem. With Firefox it works very well.
I've read the tips in the following links : Chrome, three.js: Cross-origin image load denied, https://github./mrdoob/three.js/wiki/How-to-run-things-locally, https://www.google.fr/search?q=Access-Control-Allow-Origin
I also realized the mands given:
Start Chrome executable with a mand line flag:
chrome --allow-file-access-from-files
nothing works and I'm going crazy. It is just an image on my hard drive with HTML and JS files, no server, no "origin".
Share Improve this question edited May 23, 2017 at 12:16 CommunityBot 11 silver badge asked Nov 19, 2013 at 16:27 MizurMizur 4701 gold badge4 silver badges17 bronze badges2 Answers
Reset to default 2Are you running a local server, or are you just opening the html file?
Most likely, running a localhost server will fix this issue. Mamp / Wamp are super easy to use.
If that doesn't work, you can do something drastic like chrome --disable-web-security
Keep in mind that if you start chrome with the disable web security flag, you must first shut down all other instances of chrome in order for it to work as you expect.
本文标签: javascriptCrossorigin image load denied on a local image with THREEjs on ChromeStack Overflow
版权声明:本文标题:javascript - Cross-origin image load denied on a local image with THREE.js on Chrome - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742124007a2421855.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论