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.
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.
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.
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
Last edited by
tasse
on Wed Oct 04, 2017 4:06 pm, edited 2 times in total.
Hi magreenblatt, thanks for the reply.
What should I use then? Are you suggesting I use the http scheme and intercept the request?
thanks
// edit: Tried using a
CefResourceHandlerAdapter
that returns a
CefResourceHandlerAdapter
in the
getResourceHandler(browser, request)
function. Result is the same though.
// edit2: Tried modifiying the
CefRequest
in
onBeforeResourceLoad(..)
by setting the images bytes into a postData object. Error too though.
Any further information?
Why is neither
AddCrossOriginWhitelistEntry
nor any websecurity disabling option available in JCEF anymore?
magreenblatt wrote:
Read the documentation on the CefSchemeRegistrar::AddCustomScheme method. You may be registering the scheme incorrectly, and/or your localhost server should return Access-Control-Allow-Origin headers.
Hi,
yes, just figured out that I was missing the last part.
Adding