Page 1 of 1

How to control the pop-up page window

Posted: Tue Aug 08, 2017 9:17 am
by blueflagbj
How to control this page when opening a new page window

Re: How to control the pop-up page window

Posted: Tue Aug 08, 2017 9:36 am
by salvadordf
Hi,

TChromium has a OnBeforePopup event where you can block or allow popups.

That event is now called in the UI thread and it should be easier to add your own form with a TChromium instead of letting CEF3 create a new window for you.

The /include/capi/cef_life_span_handler_capi.h file in the CEF3 sources have these comments about that event :

Code: Select all

  ///
  // Called on the UI thread before a new popup browser is created. The
  // |browser| and |frame| values represent the source of the popup request. The
  // |target_url| and |target_frame_name| values indicate where the popup
  // browser should navigate and may be NULL if not specified with the request.
  // The |target_disposition| value indicates where the user intended to open
  // the popup (e.g. current tab, new tab, etc). The |user_gesture| value will
  // be true (1) if the popup was opened via explicit user gesture (e.g.
  // clicking a link) or false (0) if the popup opened automatically (e.g. via
  // the DomContentLoaded event). The |popupFeatures| structure contains
  // additional information about the requested popup window. To allow creation
  // of the popup browser optionally modify |windowInfo|, |client|, |settings|
  // and |no_javascript_access| and return false (0). To cancel creation of the
  // popup browser return true (1). The |client| and |settings| values will
  // default to the source browser's values. If the |no_javascript_access| value
  // is set to false (0) the new browser will not be scriptable and may not be
  // hosted in the same renderer process as the source browser. Any
  // modifications to |windowInfo| will be ignored if the parent browser is
  // wrapped in a cef_browser_view_t. Popup browser creation will be canceled if
  // the parent browser is destroyed before the popup browser creation completes
  // (indicated by a call to OnAfterCreated for the popup browser).
  ///