- Code: Select all
registrar->AddCustomScheme("res", CEF_SCHEME_OPTION_STANDARD | CEF_SCHEME_OPTION_LOCAL);
and all has generally been working well. However, we recently added some web fonts to the internal css and are getting this error:
949:1 Access to font at 'res://myapp/E%3A%5Cdev%5CSample.exe/SAMPLE_WEB_FONT' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
SAMPLE_WEB_FONT:1 Failed to load resource: net::ERR_FAILED
Looking at the code comments for AddCustomScheme:
- Code: Select all
// See cef_scheme_options_t for possible values for |options|.
Looking at cef_scheme_options_t for CEF_SCHEME_OPTION_LOCAL:
- Code: Select all
///
// If CEF_SCHEME_OPTION_LOCAL is set the scheme will be treated with the same
// security rules as those applied to "file" URLs. Normal pages cannot link to
// or access local URLs. Also, by default, local URLs can only perform
// XMLHttpRequest calls to the same URL (origin + path) that originated the
// request. To allow XMLHttpRequest calls from a local URL to other URLs with
// the same origin set the CefSettings.file_access_from_file_urls_allowed
// value to true (1). To allow XMLHttpRequest calls from a local URL to all
// origins set the CefSettings.universal_access_from_file_urls_allowed value
// to true (1).
///
CEF_SCHEME_OPTION_LOCAL = 1 << 1,
However, file_access_from_file_urls_allowed and universal_access_from_file_urls_allowed do not seem to exist any longer?
So, what is the preferred way to handle this?
Thanks in advance!