I'm using Xamarin.Forms to create an app for both iOS and Android that is primarily a web browser for my company's platform. I'm trying to detect a redirect and in Android I've had no issue.
I'm using WKWebview for iOS, have a customized WkWebViewRenderer and a customized WKNavigationDelegate attached.
In Android I'm doing much the same on that platform, but it's FormsWebViewClient has an isRedirect
flag on the IWebResourceRequest
that I can hook into.
I've scoured the Assembly Browser trying to find anything related to redirect on the iOS side, but I'm coming up empty.
Here's the function I'm overriding for the iOS Navigation Delegate:
public override void DecidePolicy(WKWebView webView, WKNavigationAction navigationAction, Action<WKNavigationActionPolicy> decisionHandler)
Any help is appreciated.
P.S. as a work around I'm considering recording the last URL and then checking that against where I expect the redirect to take me, but this is a lot of work for something that should be a quick check.
For anyone that ends up needing to react to this cue, I ended up overriding this function:
public override void DidReceiveServerRedirectForProvisionalNavigation(WKWebView webView, WKNavigation navigation)