If you are a beginner, you are likely to have the same problem with me, that is, how to set a URL for CEF browser or change the URL of CEF browser.
For creating a browser, you can easily navigate and then create browser when you pass a URL. For example, navigate to "www.baidu.com". But next, you want to navigate to "www.google.com", what would you do?
Perhaps you will recreate a browser and successfully navigate to "www.google.com". But at this point, you open the Task Manager to look at, you can clearly see that there are two browser running.
So, what I'm going to say is how to SetUrl or Loadrul on the same browser.
Createbrowser:
std::wstring url = L"www.baidu.com";CefBrowserHost::CreateBrowser(info, g_web_browser_client.get(), CefString(url), browserSettings, NULL);
Next, the first is to get a pointer to the browser, then through the Getmainfram function, and then call Loadurl, to access the URL you want.
std::wstring url2 = "www.google.com"CefRefPtr<CefBrowser> browser = g_web_browser_client->GetBrowser();browser->GetMainFrame()->LoadURL(CefString(url2));
Getmainframe
publicvirtualGetMainFrame0;
Returns the main (top-level) frame for the browser window.
Loadurl
publicvirtualvoidLoadURLconst0;
Load the specified |url|.
Learn libcef--together to set the URL for your browser