WebView blank page

I published a Blazor server application in a web hosting space  and then I created a xamarin android with the following lines top open the Blazor application

    <StackLayout>

        <WebView HeightRequest="250" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Source="https://example.com" />

    </StackLayout>

and everything is working fine

If I publish the same Blazor application in another web hosting space that doesn't have a certificate, if I change the Source of the WebView to http://example2.com I see only o totally blank page on the mobile phone.

So it seems to be that the WebView doesn't work with http ?

How can I solve the problem ?

Thanks

Best 



3 Replies

JK Jeya Kasipandi Syncfusion Team August 23, 2021 11:06 AM UTC

Hi Walter,

We suggest you check with the usesCleartextTraffic to true in manifest file as like below code snippet to resolve the reported issue.

Code Snippet:

<application android:usesCleartextTraffic="true">
</application>

Please refer the below link for this
 



Please let us know if you have any other queries.

Regards,
Jeya K


WM Walter Martin August 23, 2021 08:56 PM UTC

Thanks for his reply but at the moment, none of the solution work

This is my manifest.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.shipscolorsapp" android:installLocation="auto">

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />

<application android:label="ShipsColorsApp.Android" android:theme="@style/MainTheme" android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config">

</application>

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

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

</manifest>


and this is the content of  network_security_config.xml file

<?xml version="1.0" encoding="utf-8"?>

<network-security-config>

<domain-config cleartextTrafficPermitted="true">

<domain includeSubdomains="true">www.example.com</domain>

</domain-config>

</network-security-config>


This file is correctly processed because if I change " www.example.com" with another that doesn't exists I receive the error page not found in the simulator, and if I type www.example.com in a browser the web page is correctly showed. 

The Android simulator instead shows always a blank page

If I change  www.example.com in the webview with an https address the simulator shows the page correctly

<WebView HeightRequest="250" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Source="https://example2.com" />

What else can I try ?




JK Jeya Kasipandi Syncfusion Team August 24, 2021 11:05 AM UTC

Hi Walter,

Since the reported issue is not related to Syncfusion controls, please log an issue in https://github.com/xamarin/Xamarin.Forms/issues  and follow up for further detail.

Regards,
Jeya K 


Loader.
Up arrow icon