Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

WebView not working on iOS 9??

$
0
0

Hi guys,

Even I put this configuration in my plist file and still now working:

<key>NSAppTransportSecurity<key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Actually what I want to do is just load html string in a Webview so my XAML file is like:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="DispatchApp.Pages.ProjectView">
             <StackLayout>
             <AbsoluteLayout VerticalOptions="FillAndExpand"
                HorizontalOptions="FillAndExpand">
                <WebView x:Name="webView" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0, 0, 1, 1"></WebView>
             </AbsoluteLayout>
             </StackLayout>
</ContentPage>

My cs file is :

public partial class ProjectView : ContentPage
    {
        public ProjectView(string contentHtml)
        {
            InitializeComponent ();
            var htmlSource = new HtmlWebViewSource();
            htmlSource.Html = contentHtml;
            webView.Source = htmlSource;
        }
    }

The html string I want to show is like :

<!DOCTYPE html><html><head><base href="https://xxx.ca/"><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Report Content</title> <link href="https://xxx.ca/Content/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <link href="https://xxx.ca/Content/bootstrap/bootstrap-theme.min.css" rel="stylesheet" /><link href="https://xxx.ca/Content/stylesheets/mobilehistory/site.css" rel="stylesheet" />
    <link href="https://xxx.ca/Content/stylesheets/report-content.css" rel="stylesheet" /> 
            <style type="text/css">body ul{padding:0; list-style-type: none;}body ul li{-moz-user-select: -moz-all; -webkit-user-select: all; -ms-user-select: all; user-select: all;}</style></head><body><div><table class='table table-hover table-bordered table-fixed'><tbody><tr class='report-section-title'><td colspan='6'>Overview</td></tr><tr><td colspan='3'><span class='report-field-name'>Job Name</span>:  Sobeys #4719</td><td colspan='3'><span class='report-field-name'>Site Contact</span>xxxxxxxxx
make sure you sign IN and OUT. </td></tr></tbody></table></div></body></html>

But what I got is just a blank page,, empty white page..
It works very well the same code on iOS 8 or earlier than 9. But now iOS 9 right now.
Any idea on this??


Viewing all articles
Browse latest Browse all 75885

Trending Articles