Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

After ios 11 upgrade WKWebView does not load my website

After ios 11 upgrade WKWebView does not load my website.
I added the following methods to my renderer:

    public virtual void ContentProcessDidTerminate(WKWebView webView)


    public void DidFinishNavigation(WKWebView webView, WKNavigation navigation)

        UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;

    public void DidFailNavigation(WKWebView webView, WKNavigation navigation, NSError error)
        // If navigation fails, this gets called
        Console.WriteLine("DidFailNavigation:" + error.ToString());

    public void DidFailProvisionalNavigation(WKWebView webView, WKNavigation navigation, NSError error)
        // If navigation fails, this gets called
        Console.WriteLine("DidFailProvisionalNavigation" + error.ToString());

    public void DidStartProvisionalNavigation(WKWebView webView, WKNavigation navigation)

        UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
        // When navigation starts, this gets called

The application shows didStartProvisionalNavigation but it does not move to the other methods.

I also added the following to my info.plist:


I also tried running my WKWebview against another of my sites and that one works just fine.

In Safari, after attaching it to my WKWebView, I can see that some webapi calls does not seem to complete the request. Yet in some cases the same request does complete but some others does not.

Is anyone having this type of issue?

Any help to solve this would be really appreciated.





  • hinojosachapelhinojosachapel ESMember ✭✭

    I have had a very similar situation in a project I'm working on and found the solution you posted over StackOverflow ( I think you should also post it here. It solved my problem and probably it'll be valuable for other people. BTW, thanks!

  • HectorMenesesHectorMeneses USMember ✭✭

    Hi hinojosachapel,

    I think I posted this question twice in Xamarin Forums (by mistake) and I only updated one of them with the solution. :(

    I'm glad this solution helped you.

    Here's the solution I found:

    It turns out that in iOS 11 the WKWebView is trying to navigate to "about:blank". I'm not aware of our site having that "page". Then in my DecidePolicy that page was not allowed and I guess that was also stopping my website from continuing loading normally. I added a condition to enable navigation to "about:blank" and that solved it.

    public override void DecidePolicy(WKWebView webView, WKNavigationAction navigationAction, Action decisionHandler)

        var navType = navigationAction.NavigationType;
        var targetFrame = navigationAction.TargetFrame;
        var url = navigationAction.Request.Url;
        if (
            url.ToString().StartsWith("http") && (targetFrame != null && targetFrame.MainFrame == true)
        else if (
            (url.ToString().StartsWith("http") && targetFrame == null)
            || url.ToString().StartsWith("tel:")) //Whatever your test happens to be
            Device.BeginInvokeOnMainThread(() =>
        } // NEED THIS IN IOS 11
        else if ( url.ToString().StartsWith("about") )

    Hope this helps someone else. :)

  • JongfooSheeJongfooShee MYUniversity ✭✭

    Hi @HectorMeneses, after apply your solution in my renderer, the error appear "no suitable method found to override" for this DecidePolicy function and it doesn't work.... How do you solve this? Thanks for advanced.

Sign In or Register to comment.