Trait webview2_sys::ICoreWebView2NewWindowRequestedEventArgs [−][src]
pub trait ICoreWebView2NewWindowRequestedEventArgs: IUnknown {
unsafe fn get_uri(&self, uri: *mut LPWSTR) -> HRESULT;
unsafe fn put_new_window(
&self,
new_window: *mut *mut ICoreWebView2VTable
) -> HRESULT;
unsafe fn get_new_window(
&self,
new_window: *mut *mut *mut ICoreWebView2VTable
) -> HRESULT;
unsafe fn put_handled(&self, handled: BOOL) -> HRESULT;
unsafe fn get_handled(&self, handled: *mut BOOL) -> HRESULT;
unsafe fn get_is_user_initiated(
&self,
is_user_initiated: *mut BOOL
) -> HRESULT;
unsafe fn get_deferral(
&self,
deferral: *mut *mut *mut ICoreWebView2DeferralVTable
) -> HRESULT;
unsafe fn get_window_features(
&self,
value: *mut *mut *mut ICoreWebView2WindowFeaturesVTable
) -> HRESULT;
}
Expand description
Event args for the NewWindowRequested
event. The event is run when
content inside webview requested to a open a new window (through
window.open()
and so on).
Required methods
The target uri of the new window requested.
unsafe fn put_new_window(
&self,
new_window: *mut *mut ICoreWebView2VTable
) -> HRESULT
unsafe fn put_new_window(
&self,
new_window: *mut *mut ICoreWebView2VTable
) -> HRESULT
Sets a CoreWebView2 as a result of the NewWindowRequested event. If the
NewWindow
is set, the top-level window returns as the opened WindowProxy
.
The NewWindow property should be set to a CoreWebView2 that has not been
navigated previously. Don’t use methods that cause navigation or interact
with the DOM on this CoreWebView2. Setting event handlers, changing
Settings properties, or other methods are fine to call. Once the
NewWindow is set the underlying web contents of this CoreWebView2 will be
replaced and navigated as appropriate for the new window.
After setting new window it cannot be changed and error will be return otherwise.
The methods which should affect the new web contents like AddScriptToExecuteOnDocumentCreated and add_WebResourceRequested have to be called after setting NewWindow.
unsafe fn get_new_window(
&self,
new_window: *mut *mut *mut ICoreWebView2VTable
) -> HRESULT
unsafe fn get_new_window(
&self,
new_window: *mut *mut *mut ICoreWebView2VTable
) -> HRESULT
Gets the new window.
unsafe fn put_handled(&self, handled: BOOL) -> HRESULT
unsafe fn put_handled(&self, handled: BOOL) -> HRESULT
Sets whether the NewWindowRequested
event is handled by host. If this
is FALSE
and no NewWindow
is set, the WebView opens a popup window
and it returns as opened WindowProxy
. If set to TRUE
and no
NewWindow
is set for window.open
, the opened WindowProxy
is for an
testing window object and no window loads.
The default value is FALSE
.
unsafe fn get_handled(&self, handled: *mut BOOL) -> HRESULT
unsafe fn get_handled(&self, handled: *mut BOOL) -> HRESULT
Gets whether the NewWindowRequested
event is handled by host.
unsafe fn get_is_user_initiated(&self, is_user_initiated: *mut BOOL) -> HRESULT
unsafe fn get_is_user_initiated(&self, is_user_initiated: *mut BOOL) -> HRESULT
TRUE
when the new window request was initiated through a user gesture
such as selecting an anchor tag with target. The Microsoft Edge popup
blocker is disabled for WebView so the app is able to use this flag to
block non-user initiated popups.
unsafe fn get_deferral(
&self,
deferral: *mut *mut *mut ICoreWebView2DeferralVTable
) -> HRESULT
unsafe fn get_deferral(
&self,
deferral: *mut *mut *mut ICoreWebView2DeferralVTable
) -> HRESULT
Obtain an ICoreWebView2Deferral
object and put the event into a
deferred state. Use the ICoreWebView2Deferral
object to complete the
window open request at a later time. While this event is deferred the
opener window returns a WindowProxy
to an un-navigated window, which
navigates when the deferral is complete.
unsafe fn get_window_features(
&self,
value: *mut *mut *mut ICoreWebView2WindowFeaturesVTable
) -> HRESULT
unsafe fn get_window_features(
&self,
value: *mut *mut *mut ICoreWebView2WindowFeaturesVTable
) -> HRESULT
Window features specified by the window.open
. The features should be
considered for positioning and sizing of new webview windows.
Trait Implementations
A COM compatible V-Table
Check whether a given IID is in the inheritance hierarchy of this interface