bool SimpleHandler::OnBeforePopup(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
const CefString& target_frame_name,
WindowOpenDisposition target_disposition,
bool user_gesture,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access)
{
if(!target_url.empty)
{
switch (target_disposition)
{
case WOD_NEW_FOREGROUND_TAB:
case WOD_NEW_BACKGROUND_TAB:
case WOD_NEW_POPUP:
case WOD_NEW_WINDOW:
browser->GetMainFrame()->LoadURL(target_url);
return true; //停止创建
}
}
// return false; //为false时还是会弹出新窗体的
return true;
}