zoukankan      html  css  js  c++  java
  • CEF中弹出窗口的处理

    CEF开发如果不想在弹出窗口中打开网页,即想要在当前窗体加载目标Url,

    就需要重写OnBeforePopup,它是属于CefLifeSpanHandler类中的.

    /*--cef(optional_param=target_url,optional_param=target_frame_name)--*/
    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) { 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; }

    第一个参数browser代表了发出popup请求的浏览器对象,

    frame是发出popup请求的那个frame,

    target_url是要加载的目标url,

    target_disposition是显示方式。

    返回true就可以禁止创建新窗口。

  • 相关阅读:
    codeforces #330 div2
    codeforces #332 div2
    Codeforces Round #331 (Div. 2)C. Wilbur and Points
    poj 01背包
    zoj 1200 Mining
    nginx反向代理与负载均衡
    springcloud----config分布式配置中心
    springcloud--zuul 网关
    springcloud ----Hystrix熔断器
    docker私有镜像仓库harbor搭建和配置
  • 原文地址:https://www.cnblogs.com/sinceret/p/10346171.html
Copyright © 2011-2022 走看看