Here are the code comments for that event in the CEF source code :
https://github.com/chromiumembedded/cef ... capi.h#L63
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|
// popup browser return true (1). The |client| and |settings| values will
// 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). The
// |extra_info| parameter provides an opportunity to specify extra information
// specific to the created popup browser that will be passed to
// cef_render_process_handler_t::on_browser_created() in the render process.
may have the URL of the new popup window but it may be empty.
If you want to cancel the creation of the new popup window set the Result
parameter to True.
If the target_url is empty then you can also use the TChromium.OnBeforeBrowse event to cancel the navigation.
https://magpcss.org/ceforum/apidocs3/pr ... bool,bool)
As you can see, the popup window creation in Chromium is complicated and this event is executed in a CEF thread which makes things even more complicated because the VCL should only be handled in the main application thread.
You can let CEF create the popup windows as shown in the MiniBrowser demo but you can also use Delphi forms as you can see in the PopupBrowser2 demo.
In all cases, you have to close all the browsers properly before shutting down the application. Follow the destruction steps in the demo you used as the template for your application or follow the steps in the ToolboxBrowser if you have many open browsers.