Forum Xamarin Xamarin.Forms

How to load html content from Url to Webview

I have a url : & on this Url my Html content is present which I want to show in Webview.
Can anyone help me on this.


  • ManojkumarMaliManojkumarMali USMember ✭✭✭

    Have you checked this xamarin-forms/webview?

  • rahulrahul Member ✭✭
    edited September 2018

    thanks @JohnHardman & @ManojkumarMali for the quick response, i've gone through the webview docs u've but still stuck in some somewhere ,

    My xaml goes like this:
    < WebView x:Name="Browser" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
    < WebView.Source>
    < HtmlWebViewSource x:Name="htmlSource" Html="{Binding eventHtmlContent}"/>
    < / WebView.Source>
    < /WebView>

    and behind the xaml i am doing this:
    Browser.Source = new UrlWebViewSource { Url = " " };

    I am getting flat html code as an output.

    if I am setting the HtmlWebViewSource in backend with html text then i am getting desired output but from the url i am unable to do same.
    Can u guys tell me what i am missing .

  • JohnHardmanJohnHardman GBUniversity admin

    @rahul -

    <WebView Source=""
            WidthRequest="1000" />
  • LandLuLandLu Member, Xamarin Team Xamurai

    @rahul Really confused about what you want to achieve. You want to use binding to set the webView's source or just use code behind to set it directly?
    Please describe more clearly about your issue.

  • JohnHardmanJohnHardman GBUniversity admin

    @rahul - One more area of clarification - do you want to show the webpage, or do you want to show the text of the HTML of the webpage. My answer above assumes the former.

Sign In or Register to comment.