---
title: "webView(_:decidePolicyFor:preferences:decisionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wknavigationdelegate/webview(_:decidepolicyfor:preferences:decisionhandler:)"
---

# webView(_:decidePolicyFor:preferences:decisionHandler:)

Asks the delegate for permission to navigate to new content based on the specified preferences and action information.

## Declaration

```swift
optional func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping @MainActor @Sendable (WKNavigationActionPolicy, WKWebpagePreferences) -> Void)
```

```swift
optional func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences) async -> (WKNavigationActionPolicy, WKWebpagePreferences)
```

## Parameters

- `webView`: The web view from which the navigation request began.
- `navigationAction`: Details about the action that triggered the navigation request.
- `preferences`: The default preferences to use when displaying the new webpage. Specify the default preferences for pages using the doc://com.apple.webkit/documentation/WebKit/WKWebViewConfiguration/defaultWebpagePreferences property of doc://com.apple.webkit/documentation/WebKit/WKWebViewConfiguration when you create your web view.
- `decisionHandler`: A completion handler block to call with the results about whether to allow or cancel the navigation. This handler has no return value and takes the following parameters:

## Discussion

Discussion Use this method to allow or deny a navigation request that originated with the specified action. The web view calls this method after the interaction occurs but before it attempts to load any content. If you implement this method, always execute the decisionHandler block at some point. You may execute it synchronously from your delegate method’s implementation, or execute it asynchronously after your method returns. If your delegate object implements this method, the web view doesn’t call the webView(_:decidePolicyFor:decisionHandler:) method.

## See Also

### Allowing or denying navigation requests

- [webView(_:decidePolicyFor:decisionHandler:)](webkit/wknavigationdelegate/webview(_:decidepolicyfor:decisionhandler:)-2ni62.md)
- [WKNavigationActionPolicy](webkit/wknavigationactionpolicy.md)
- [webView(_:decidePolicyFor:decisionHandler:)](webkit/wknavigationdelegate/webview(_:decidepolicyfor:decisionhandler:)-19mn2.md)
- [WKNavigationResponsePolicy](webkit/wknavigationresponsepolicy.md)
