LifeSpanHandlerOnBeforePopup Method |
Version 109.1.110
Called before a popup window is created. By default the popup (browser) is created in a new native window.
Namespace:
CefSharp.WinForms.Handler
Assembly:
CefSharp.WinForms (in CefSharp.WinForms.dll) Version: 109.1.110.0 (109.1.110.0)
Syntax protected override bool OnBeforePopup(
IWebBrowser chromiumWebBrowser,
IBrowser browser,
IFrame frame,
string targetUrl,
string targetFrameName,
WindowOpenDisposition targetDisposition,
bool userGesture,
IPopupFeatures popupFeatures,
IWindowInfo windowInfo,
IBrowserSettings browserSettings,
ref bool noJavascriptAccess,
out IWebBrowser newBrowser
)
protected:
virtual bool OnBeforePopup(
IWebBrowser^ chromiumWebBrowser,
IBrowser^ browser,
IFrame^ frame,
String^ targetUrl,
String^ targetFrameName,
WindowOpenDisposition targetDisposition,
bool userGesture,
IPopupFeatures^ popupFeatures,
IWindowInfo^ windowInfo,
IBrowserSettings^ browserSettings,
bool% noJavascriptAccess,
[OutAttribute] IWebBrowser^% newBrowser
) override
Parameters
- chromiumWebBrowser
- Type: CefSharpIWebBrowser
the ChromiumWebBrowser control - browser
- Type: CefSharpIBrowser
The browser instance that launched this popup. - frame
- Type: CefSharpIFrame
The HTML frame that launched this popup. - targetUrl
- Type: SystemString
The URL of the popup content. (This may be empty/null) - targetFrameName
- Type: SystemString
The name of the popup. (This may be empty/null) - targetDisposition
- Type: CefSharpWindowOpenDisposition
The value indicates where the user intended to
open the popup (e.g. current tab, new tab, etc) - userGesture
- Type: SystemBoolean
The value will be true if the popup was opened via explicit user gesture
(e.g. clicking a link) or false if the popup opened automatically (e.g. via the DomContentLoaded event). - popupFeatures
- Type: CefSharpIPopupFeatures
structure contains additional information about the requested popup window - windowInfo
- Type: CefSharpIWindowInfo
window information - browserSettings
- Type: CefSharpIBrowserSettings
browser settings, defaults to source browsers - noJavascriptAccess
- Type: SystemBoolean
value indicates whether the new browser window should be scriptable
and in the same process as the source browser. - newBrowser
- Type: CefSharpIWebBrowser
EXPERIMENTAL - Low level this allows for assigning the CefClient instance associated with the new ChromiumWebBrowser instance to the CefClient param of the CefLifeSpanHandler::OnBeforeBrowser method.
This allows for all the handlers, LifeSpanHandler, DisplayHandler, etc to be associated with the CefClient of the new ChromiumWebBrowser instance to be associated with the popup (browser).
WPF/WinForms specific code is still required to host the popup (browser) in the new ChromiumWebBrowser instance.
Set to null for default behaviour. If you return true (cancel popup creation) then his property **MUST** be null, an exception will be thrown otherwise.
Return Value
Type:
Boolean
By default the popup (browser) is opened in a new native window. If you return true then creation of the popup (browser) is cancelled, no further action will occur.
Otherwise return false to allow creation of the popup (browser).
Remarks
NOTE: DevTools popups DO NOT trigger OnBeforePopup.
See Also