Custom Scheme Handler Allow Cross Origin Issue.

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Custom Scheme Handler Allow Cross Origin Issue.

Postby HarshMakadia » Fri Sep 22, 2017 8:08 am

I have registered my custom scheme with

Code: Select all
void FCEFBrowserApp::OnRegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar) {
    registrar->AddCustomScheme("myscheme", true, false, false);
}


Code: Select all
void FCEFBrowserApp::OnContextInitialized()
{   
    CefRegisterSchemeHandlerFactory("myscheme", "test", new FDCClientSchemeHandlerFactory());
}


I have my application hosted in server and I'm accessing my page with HTTP & HTTPS protocols. So with these changes, I'm able to access my local file as

Code: Select all
<img src="myscheme://test/fire.jpg" height="100px" width="100px" />

but when I tried to access the same file with XMLHttpRequest(), it's showing me "XMLHttpRequest cannot load myscheme://test/fire.jpg. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource." error. Any idea on how to resolve this error?

I have tried registering myscheme as standard and also tried adding header with
Code: Select all
req.setRequestHeader('Access-Control-Allow-Origin', '*')
HarshMakadia
Newbie
 
Posts: 5
Joined: Tue Jul 18, 2017 11:18 pm

Re: Custom Scheme Handler Allow Cross Origin Issue.

Postby magreenblatt » Fri Sep 22, 2017 8:40 am

Upgrade to a CEF version that supports the |is_cors_enabled| argument to AddCustomScheme.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Custom Scheme Handler Allow Cross Origin Issue.

Postby HarshMakadia » Tue Sep 26, 2017 5:45 am

Can you please let me the best way to update the C++ CEF3 files in Unreal engine ?
HarshMakadia
Newbie
 
Posts: 5
Joined: Tue Jul 18, 2017 11:18 pm

Re: Custom Scheme Handler Allow Cross Origin Issue.

Postby magreenblatt » Wed Sep 27, 2017 4:31 am

Sorry, I'm not familiar with Unreal engine. You should try asking in a support channel for that product.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Custom Scheme Handler Allow Cross Origin Issue.

Postby HarshMakadia » Wed Sep 27, 2017 5:17 am

Thanks, I'll try to figure it out for Unreal engine.

Also wanted to know about this error which is thrown from the DLL (Exception thrown at 0x00007FFC372A14DD (libcef.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x000000000000001D.) In case if you know about this error.


Thanks,
Harsh Makadia
HarshMakadia
Newbie
 
Posts: 5
Joined: Tue Jul 18, 2017 11:18 pm

Re: Custom Scheme Handler Allow Cross Origin Issue.

Postby magreenblatt » Wed Sep 27, 2017 7:16 am

HarshMakadia wrote:Also wanted to know about this error which is thrown from the DLL (Exception thrown at 0x00007FFC372A14DD (libcef.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x000000000000001D.) In case if you know about this error.

WIthout a symbolized call stack this information isn't meaningful.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 30 guests