Contents

download(_:willPerformHTTPRedirection:newRequest:decisionHandler:)

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

Declaration

optional func download(_ download: WKDownload, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, decisionHandler: @escaping @MainActor @Sendable (WKDownload.RedirectPolicy) -> Void)
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

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