WKNavigationDelegate
Methods for accepting or rejecting navigation changes, and for tracking the progress of navigation requests.
Declaration
@MainActor protocol WKNavigationDelegate : NSObjectProtocolMentioned in
Overview
Implement the methods of the WKNavigationDelegate protocol in the object you use to coordinate changes in your web view’s main frame. As the user attempts to navigate web content, the web view coordinates with its navigation delegate to manage any transitions. For example, you might use these methods to restrict navigation from specific links within your content. You might also use them to track the progress of requests, and to respond to errors and authentication challenges.
Topics
Allowing or denying navigation requests
webView(_:decidePolicyFor:preferences:decisionHandler:)webView(_:decidePolicyFor:decisionHandler:)WKNavigationActionPolicywebView(_:decidePolicyFor:decisionHandler:)WKNavigationResponsePolicy
Tracking the load progress of a request
webView(_:didStartProvisionalNavigation:)webView(_:didReceiveServerRedirectForProvisionalNavigation:)webView(_:didCommit:)webView(_:didFinish:)
Responding to authentication challenges
webView(_:didReceive:completionHandler:)webView(_:authenticationChallenge:shouldAllowDeprecatedTLS:)
Responding to navigation errors
webView(_:didFail:withError:)webView(_:didFailProvisionalNavigation:withError:)webViewWebContentProcessDidTerminate(_:)