How to do a CEF window refresh?

Abhimanyu Vohra picture Abhimanyu Vohra · Oct 1, 2013 · Viewed 11.7k times · Source

I have an app with 2 tabs. The container of app is developed in Native code and CEF has been used to open html pages in one of the tabs. When I switch from Tab 1 (Native) to Tab 2(CEF) contents of Tab 1 are visible on Tab 2, though Tab 2 has html page loaded. As I hover mouse over Tab 2 in this situation or do any activity on Tab 2(which has presently content of Tab 1 visible), html content becomes visible. I have checked that I hide/show calls are properly being sent.

As I am not able to find any solution I would like to know if there is some way to refresh the CEF page. I think if I am able to refresh Tab 2 at every switch to Tab 2 it should work fine. Thanks

Answer

Bob Cromwell picture Bob Cromwell · Feb 28, 2014

Not sure what platform/language you are using. The following C++ code will reload the web page.

CefRefPtr<ClientHandler> g_handler;
g_handler->GetBrowser()->Reload();

You could find cefclient project from the official package, It demonstrates various CEF API usage.