WKWebView and redirect 302 responses
Asked Answered
L

0

8

I believe WKWebView will open pages if the response has a status of 302. Can I stop the redirection from happening? Is there a delegate method that I can implement to decide if it should continue to navigate to the new resource?

optional func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: (WKNavigationResponsePolicy) -> Void)

Does not seem to be called if there was a redirection.

Lipinski answered 15/9, 2016 at 18:41 Comment(3)
I am also facing the same issue. Hope you find some workaround. If any, please share. Its urgentZagreus
agreed. That delegate is not invoked on redirect. At least as of iOS 10. There appears - as yet - no way to prevent the redirect.Easley
Noway in WKWebView. However I use URLSession to send the request instead and capture 302 by myself do this trick. Maybe you should have a tryPopgun

© 2022 - 2024 — McMap. All rights reserved.