- 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', '*')