Forum Xamarin.Forms

How to use a webview with a local ip?

I have a local web service published by an ESP8266, from the browser of both the phone and my pc I can open it without problems, now I would like to embed that page in a webview, but when it is run it opens a blank page.

I'm trying something like this:

            browser = new WebView
            {
                Source = "https://192.168.0.77",
            };
            Content = browser;

Does anyone know if it is possible?

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai
    edited August 2020

    I can open it without problems, now I would like to embed that page in a webview, but when it is run it opens a blank page.

    Did you add the INTERNET permission for the project? Make sure the permission has been added in the AndroidManifest.xml.

    <uses-permission android:name="android.permission.INTERNET"/> 
    

    If the permission has been added, try setting JavaScriptEnabled to true on native.

    Refer to:
    https://stackoverflow.com/questions/15933075/android-webview-cant-connect-to-local-ip-address

Sign In or Register to comment.