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就可以禁止创建新窗口。

  • 相关阅读:
    PHP的错误和异常处理
    PHP 页面编码声明方法详解(header或meta)
    Sentinel实现Redis高可用
    Linux学习系列之Iptables
    Python学习系列之logging模块
    [scrapy]Item Loders
    [scrapy]实例:爬取jobbole页面
    mongo开启验证
    python创建虚拟环境
    elastalert邮件报警
  • 原文地址:https://www.cnblogs.com/sinceret/p/10346171.html
Copyright © 2011-2022 走看看