WebView2.NavigationStarting 事件

定义

当 WebView2 的main帧导航到其他 URI 时发生。

// Register
event_token NavigationStarting(TypedEventHandler<WebView2, CoreWebView2NavigationStartingEventArgs const&> const& handler) const;

// Revoke with event_token
void NavigationStarting(event_token const* cookie) const;

// Revoke with event_revoker
WebView2::NavigationStarting_revoker NavigationStarting(auto_revoke_t, TypedEventHandler<WebView2, CoreWebView2NavigationStartingEventArgs const&> const& handler) const;
public event TypedEventHandler<WebView2,CoreWebView2NavigationStartingEventArgs> NavigationStarting;
function onNavigationStarting(eventArgs) { /* Your code */ }
webView2.addEventListener("navigationstarting", onNavigationStarting);
webView2.removeEventListener("navigationstarting", onNavigationStarting);
- or -
webView2.onnavigationstarting = onNavigationStarting;
Public Custom Event NavigationStarting As TypedEventHandler(Of WebView2, CoreWebView2NavigationStartingEventArgs) 

事件类型

注解

重定向也会引发此事件,并且导航 ID 与原始 ID 相同。

适用于