---
title: "download(_:willPerformHTTPRedirection:newRequest:decisionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkdownloaddelegate/download(_:willperformhttpredirection:newrequest:decisionhandler:)"
---

# download(_:willPerformHTTPRedirection:newRequest:decisionHandler:)

Asks the delegate to respond to the download’s redirect response.

## Declaration

```swift
optional func download(_ download: WKDownload, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, decisionHandler: @escaping @MainActor @Sendable (WKDownload.RedirectPolicy) -> Void)
```

```swift
optional func download(_ download: WKDownload, decidedPolicyForHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest) async -> WKDownload.RedirectPolicy
```

## Parameters

- `download`: The download that receives the redirect response.
- `response`: The redirect response.
- `request`: The new request the web view sends as a result of the redirect response.
- `decisionHandler`: A closure you must invoke, providing a download redirect policy that indicates whether to proceed with the redirect.

## Discussion

Discussion Determine whether to proceed with the redirect. Then invoke the decisionHandler closure, providing a download redirect policy that indicates whether to proceed with the redirect. If you don’t implement this method, the web view proceeds with all redirects.

## See Also

### Responding to Redirects

- [WKDownload.RedirectPolicy](webkit/wkdownload/redirectpolicy.md)
