CHROME,JS: Cross-origin image load denied

Question!

I'm using THREE.js and adding an material like this

var materialWall = new materialClass( { color: 0xffffff, map: THREE.ImageUtils.loadTexture( 'images/a.png' ) } );

It works correctly in Chrome, IE, FF, until 3 days ago, after I update Chrome to the latest dev version (17).

Chrome 17 just cannot load the image correctly:

Cross-origin image load denied by Cross-Origin Resource Sharing policy.

I'm wondering why, since the image is clearly in the same domain, how come the CROSS-ORIGIN stuff then?

is this a bug of chrome or THREE.js or my code?

By : Nano WANG


Answers

this worked for me at the command line\terminal:

./chrome.exe --disable-web-security

*note that you must close all instances of chrome before executing the command for it to work.

By : Ice101781


Perfect solution for:

THREE.js: Cross-origin image load denied

Just add timestamp to the image url. I don't know the logic behind it, but it works.

Example:

var material = new THREE.MeshBasicMaterial({
  map: loader.load(url + "?v=" + (new Date()).toString(), function() {
    animate();
  })
});


You can also run a simple HTTP server using python by running the following command from your root folder.

python -m SimpleHTTPServer 8000
By : Santosh


This video can help you solving your question :)
By: admin