I am trying to build load a texture with ThreeJS within JCEF.
I have an issue with CORS though, always getting an error message like:
Access to Image at 'img://textures/texture1.jpg' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
I tried the following:
- Starting the cef app with the flags
- Code: Select all
-–disable-web-security
--allow-file-access-from-files
like cefApp = CefApp.getInstance(new String[]{"-–disable-web-security", "--allow-file-access-from-files"});
I tried all 4 combinations here with the following options:
- Directly loading the jpg in the js code (full path)
- Code: Select all
Error:
file:///static.html: Access to Image at 'file:///my/textures/texture1.jpg' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.
- Setting up a webservice @ localhost
- Code: Select all
Error:
2017-10-02 15:30:40 WARN 05E [CefLogDisplayHandler.onConsoleMessage]: [0] file:///static.html: Access to Image at 'http://localhost:8000/texture1.jpg' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
- Registering a scheme "img://example/"
- Code: Select all
Error:
file:///static.html: Access to Image at 'img://example/texture1.jpg' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Really appreciate any help!
BR