How To Open Web URL Using WebView Control In Xamarin.Forms Application For Android And UWP

WebView is a view for displaying web and HTML content in your app. Unlike OpenUri, which takes the user to the web browser on the device, WebView displays the HTML content inside your app.

Reading this article, you will learn how to open Web URLs using WebView in Xamarin Forms application for Android and Universal Windows Platform with XAML and Visual C# in cross platform application development.

The following important tools are required for developing UWP,

  1. Windows 10 (Recommended)
  2. Visual Studio 2017 RC Community/Enterprise/Professional Edition (It is a Free trial software available online)
  3. Using Visual studio 2017 Installer, Enable the feature of Mobile development with .NET.

Now we can discuss step by step App development.

Step 1

Open Visual studio 2017 RC -> Start -> New Project-> Select Cross-Platform (under Visual C#->Cross Platform App-> Give the Suitable Name for your App (XamFormWebView) ->OK.

Step 2

Select the Cross Platform template as Blank APP ->Set UI Technology as Forms and Sharing as PCL and Afterwards, Visual Studio creates 4 projects (Portable, Droid, iOS, UWP) and displays Getting Started.XamarinPage,

 

Step 3

In MainPage.Xaml Page , add Label and WebView tags

 

Step 4

We will test Android and UWP. So, we can set the Multiple Startup Projects as XamFormWebView.Droid and XamFormWebView.UWP (universal Windows)

  

Step 5

Change the Configuration Manager settings, Go to Build -> Configuration Manager,

Uncheck the Build and deploy options to the iOS and Check the Droid and UWP

 

Step 6

Deploy your App to Android Emulator and Local Machine (UWP) and the output of the XamFormTextCell App is,

 

Summary

Now you can successfully open the Web URL using WebView in Xamarin Forms application for Cross Platform Application Development using Visual C# and Xamarin.