pub unsafe trait WKNavigationDelegate: NSObjectProtocol + MainThreadOnly {
Show 14 methods
// Provided methods
unsafe fn webView_decidePolicyForNavigationAction_decisionHandler(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
decision_handler: &Block<dyn Fn(WKNavigationActionPolicy)>,
)
where Self: Sized + Message { ... }
unsafe fn webView_decidePolicyForNavigationAction_preferences_decisionHandler(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
preferences: &WKWebpagePreferences,
decision_handler: &Block<dyn Fn(WKNavigationActionPolicy, NonNull<WKWebpagePreferences>)>,
)
where Self: Sized + Message { ... }
unsafe fn webView_decidePolicyForNavigationResponse_decisionHandler(
&self,
web_view: &WKWebView,
navigation_response: &WKNavigationResponse,
decision_handler: &Block<dyn Fn(WKNavigationResponsePolicy)>,
)
where Self: Sized + Message { ... }
unsafe fn webView_didStartProvisionalNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
)
where Self: Sized + Message { ... }
unsafe fn webView_didReceiveServerRedirectForProvisionalNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
)
where Self: Sized + Message { ... }
unsafe fn webView_didFailProvisionalNavigation_withError(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
error: &NSError,
)
where Self: Sized + Message { ... }
unsafe fn webView_didCommitNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
)
where Self: Sized + Message { ... }
unsafe fn webView_didFinishNavigation(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
)
where Self: Sized + Message { ... }
unsafe fn webView_didFailNavigation_withError(
&self,
web_view: &WKWebView,
navigation: Option<&WKNavigation>,
error: &NSError,
)
where Self: Sized + Message { ... }
unsafe fn webView_didReceiveAuthenticationChallenge_completionHandler(
&self,
web_view: &WKWebView,
challenge: &NSURLAuthenticationChallenge,
completion_handler: &Block<dyn Fn(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential)>,
)
where Self: Sized + Message { ... }
unsafe fn webViewWebContentProcessDidTerminate(&self, web_view: &WKWebView)
where Self: Sized + Message { ... }
unsafe fn webView_authenticationChallenge_shouldAllowDeprecatedTLS(
&self,
web_view: &WKWebView,
challenge: &NSURLAuthenticationChallenge,
decision_handler: &Block<dyn Fn(Bool)>,
)
where Self: Sized + Message { ... }
unsafe fn webView_navigationAction_didBecomeDownload(
&self,
web_view: &WKWebView,
navigation_action: &WKNavigationAction,
download: &WKDownload,
)
where Self: Sized + Message { ... }
unsafe fn webView_navigationResponse_didBecomeDownload(
&self,
web_view: &WKWebView,
navigation_response: &WKNavigationResponse,
download: &WKDownload,
)
where Self: Sized + Message { ... }
}
WKNavigationDelegate
only.Expand description
A class conforming to the WKNavigationDelegate protocol can provide methods for tracking progress for main frame navigations and for deciding policy for main frame and subframe navigations.
See also Apple’s documentation
Provided Methods§
Available on crate feature WKNavigationAction
and crate feature WKWebView
and crate feature block2
and crate feature objc2-app-kit
and macOS only.
WKNavigationAction
and crate feature WKWebView
and crate feature block2
and crate feature objc2-app-kit
and macOS only.Decides whether to allow or cancel a navigation.
Parameter webView
: The web view invoking the delegate method.
Parameter navigationAction
: Descriptive information about the action
triggering the navigation request.
Parameter decisionHandler
: The decision handler to call to allow or cancel the
navigation. The argument is one of the constants of the enumerated type WKNavigationActionPolicy.
If you do not implement this method, the web view will load the request or, if appropriate, forward it to another application.
Available on crate feature WKNavigationAction
and crate feature WKWebView
and crate feature WKWebpagePreferences
and crate feature block2
and crate feature objc2-app-kit
and macOS only.
WKNavigationAction
and crate feature WKWebView
and crate feature WKWebpagePreferences
and crate feature block2
and crate feature objc2-app-kit
and macOS only.Decides whether to allow or cancel a navigation.
Parameter webView
: The web view invoking the delegate method.
Parameter navigationAction
: Descriptive information about the action
triggering the navigation request.
Parameter preferences
: The default set of webpage preferences. This may be
changed by setting defaultWebpagePreferences on WKWebViewConfiguration.
Parameter decisionHandler
: The policy decision handler to call to allow or cancel
the navigation. The arguments are one of the constants of the enumerated type
WKNavigationActionPolicy, as well as an instance of WKWebpagePreferences.
If you implement this method, -webView:decidePolicyForNavigationAction:decisionHandler: will not be called.
Available on crate feature WKNavigationResponse
and crate feature WKWebView
and crate feature block2
and crate feature objc2-app-kit
and macOS only.
WKNavigationResponse
and crate feature WKWebView
and crate feature block2
and crate feature objc2-app-kit
and macOS only.Decides whether to allow or cancel a navigation after its response is known.
Parameter webView
: The web view invoking the delegate method.
Parameter navigationResponse
: Descriptive information about the navigation
response.
Parameter decisionHandler
: The decision handler to call to allow or cancel the
navigation. The argument is one of the constants of the enumerated type WKNavigationResponsePolicy.
If you do not implement this method, the web view will allow the response, if the web view can show it.
Available on crate feature WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.
WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.Invoked when a main frame navigation starts.
Parameter webView
: The web view invoking the delegate method.
Parameter navigation
: The navigation.
Available on crate feature WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.
WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.Invoked when a server redirect is received for the main frame.
Parameter webView
: The web view invoking the delegate method.
Parameter navigation
: The navigation.
Available on crate feature WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.
WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.Invoked when an error occurs while starting to load data for the main frame.
Parameter webView
: The web view invoking the delegate method.
Parameter navigation
: The navigation.
Parameter error
: The error that occurred.
Available on crate feature WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.
WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.Invoked when content starts arriving for the main frame.
Parameter webView
: The web view invoking the delegate method.
Parameter navigation
: The navigation.
Available on crate feature WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.
WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.Invoked when a main frame navigation completes.
Parameter webView
: The web view invoking the delegate method.
Parameter navigation
: The navigation.
Available on crate feature WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.
WKNavigation
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.Invoked when an error occurs during a committed main frame navigation.
Parameter webView
: The web view invoking the delegate method.
Parameter navigation
: The navigation.
Parameter error
: The error that occurred.
Sourceunsafe fn webView_didReceiveAuthenticationChallenge_completionHandler(
&self,
web_view: &WKWebView,
challenge: &NSURLAuthenticationChallenge,
completion_handler: &Block<dyn Fn(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential)>,
)
Available on crate feature WKWebView
and crate feature block2
and crate feature objc2-app-kit
and macOS only.
unsafe fn webView_didReceiveAuthenticationChallenge_completionHandler( &self, web_view: &WKWebView, challenge: &NSURLAuthenticationChallenge, completion_handler: &Block<dyn Fn(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential)>, )
WKWebView
and crate feature block2
and crate feature objc2-app-kit
and macOS only.Invoked when the web view needs to respond to an authentication challenge.
Parameter webView
: The web view that received the authentication challenge.
Parameter challenge
: The authentication challenge.
Parameter completionHandler
: The completion handler you must invoke to respond to the challenge. The
disposition argument is one of the constants of the enumerated type
NSURLSessionAuthChallengeDisposition. When disposition is NSURLSessionAuthChallengeUseCredential,
the credential argument is the credential to use, or nil to indicate continuing without a
credential.
If you do not implement this method, the web view will respond to the authentication challenge with the NSURLSessionAuthChallengeRejectProtectionSpace disposition.
Sourceunsafe fn webViewWebContentProcessDidTerminate(&self, web_view: &WKWebView)
Available on crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.
unsafe fn webViewWebContentProcessDidTerminate(&self, web_view: &WKWebView)
WKWebView
and crate feature objc2-app-kit
and macOS only.Invoked when the web view’s web content process is terminated.
Parameter webView
: The web view whose underlying web content process was terminated.
Sourceunsafe fn webView_authenticationChallenge_shouldAllowDeprecatedTLS(
&self,
web_view: &WKWebView,
challenge: &NSURLAuthenticationChallenge,
decision_handler: &Block<dyn Fn(Bool)>,
)
Available on crate feature WKWebView
and crate feature block2
and crate feature objc2-app-kit
and macOS only.
unsafe fn webView_authenticationChallenge_shouldAllowDeprecatedTLS( &self, web_view: &WKWebView, challenge: &NSURLAuthenticationChallenge, decision_handler: &Block<dyn Fn(Bool)>, )
WKWebView
and crate feature block2
and crate feature objc2-app-kit
and macOS only.Invoked when the web view is establishing a network connection using a deprecated version of TLS.
Parameter webView
: The web view initiating the connection.
Parameter challenge
: The authentication challenge.
Parameter decisionHandler
: The decision handler you must invoke to respond to indicate whether or not to continue with the connection establishment.
WKDownload
and crate feature WKNavigationAction
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.WKDownload
and crate feature WKNavigationResponse
and crate feature WKWebView
and crate feature objc2-app-kit
and macOS only.