Sunday 14 January 2018

javascript - Three.js loading local MTL files on Chrome

I'm having a problem loading MTL files on Chrome with
Three.js. It works fine on Safari but I'm getting a cross origin request error in
Chrome. I don't know how to fix this issue for local files. It does work fine if I
publish this to an http website on
Chrome.



var mtlLoader = new
THREE.MTLLoader();
mtlLoader.setPath('assets/');
mtlLoader.setBaseUrl('assets/');
mtlLoader.load('file.mtl',
function(materials) {

...
});


three.js:18280
XMLHttpRequest cannot load file:///.../assets/file.mtl. Cross origin requests are only
supported for protocol schemes: http, data, chrome, chrome-extension,
https.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...