Reputation: 2333
I've succeeded integrating CEF with my wxWidgets application, but It don't render pages when using CefFrame::LoadURL
it only loads and renders content successfully if the CefFrame::LoadString
function is called.
If the requested URL is not valid or not found it outputs an in-browser error with code=-106
The code calling the CEF:
CefMainArgs main_args(wxGetApp().argc, wxGetApp().argv);
SampleCefApp *sampleAppObj = new SampleCefApp(frame);
CefRefPtr<SampleCefApp> app(sampleAppObj);
int exit_code = CefExecuteProcess(main_args, app.get(), NULL);
if (exit_code >= 0)
{
return exit_code;
}
CefSettings settings;
CefString(&settings.javascript_flags).FromASCII("--harmony");
// Initialize CEF for the browser process.
CefInitialize(main_args, settings, app.get(), NULL);
CefRefPtr<CefBrowser> cefBrowserObj = sampleAppObj->theBrowser;
CefRefPtr<CefFrame> cefMainFrame = cefBrowserObj->GetMainFrame();
cefMainFrame->LoadURL("file://home/sameh/Code/wxCEF/resources/app.html");
Output application screenshot:
Upvotes: 1
Views: 6557
Reputation: 20675
Code -106 from net_error_list.h (http://src.chromium.org/svn/trunk/src/net/base/net_error_list.h):
// The Internet connection has been lost.
NET_ERROR(INTERNET_DISCONNECTED, -106)
Try loading the url by pasing it to the CreateBrowser() function and see if that helps. It might be a timing issue, CreateBrowser() works asynchronously, browser/frame may not yet be ready for use when calling LoadURL(). Try using CreateBrowserSync() instead.
EDIT.
There should be three slashes after the file protocol, file://home/czarek/asd.txt
generates error in Google Chrome, while file:///home/czarek/asd.txt
works fine.
Upvotes: 1