file_access_from_file_urls = STATE_ENABLED;
universal_access_from_file_urls = STATE_ENABLED;
web_security = STATE_DISABLED;
Here are some changes which were made
- Code: Select all
TSharedPtr<IWebBrowserWindow> FWebBrowserSingleton::CreateBrowserWindow(const FCreateBrowserWindowSettings& WindowSettings)
{
#if WITH_CEF3
static bool AllowCEF = !FParse::Param(FCommandLine::Get(), TEXT("nocef"));
if (AllowCEF)
{
// Information used when creating the native window.
CefWindowInfo WindowInfo;
// Specify CEF browser settings here.
CefBrowserSettings BrowserSettings;
// Disable plugins
BrowserSettings.plugins = STATE_DISABLED;
BrowserSettings.file_access_from_file_urls = STATE_ENABLED;
BrowserSettings.universal_access_from_file_urls = STATE_ENABLED;
BrowserSettings.web_security = STATE_DISABLED;
}
}
Also made changes in the OnBeforeCommandLineProcessing method of CEF Library where the user can change the settings of the browser.
Here is the sample code
- Code: Select all
void FCEFBrowserApp::OnBeforeCommandLineProcessing(const CefString& ProcessType, CefRefPtr< CefCommandLine > CommandLine)
{
CommandLine->AppendSwitch("allow-file-access-from-files");
CommandLine->AppendSwitch("disable-gpu");
CommandLine->AppendSwitch("disable-web-security");
CommandLine->AppendSwitch("disable-gpu-compositing");
}
I'm trying to disable web security inside the Unreal Engine Web Browser. Is there is any extra setting which we need to do in order to disable the web security and allow the files to be accessed by the following path
file:///C:/image.jpg. (Please note that opening the sample url in browser loads the image)
I'm basically using web browser inside the unreal engine which uses CEF library C++. Can someone show me sample code to disable this web security ?