Reputation: 177
I am creating a webview that will load my url link for example "http://test.rf.gd/index" but when I tried to load this in webview xamarin it doesn't load it says net::ERR_CLEARTEXT_NOT_PERMITTED
I created a new Cookie webview and it doesn't work too
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using System.Net;
using System.Web;
using Xamarin.Forms;
namespace OMA.WebCookie
{
public class CookieWebView : WebView
{
public static readonly BindableProperty UrlProperty = BindableProperty.Create(propertyName: "Url", returnType: typeof(string), declaringType: typeof(CookieWebView), defaultValue: default(string));
public string Url
{
get { return (string)GetValue(UrlProperty); }
set { SetValue(UrlProperty, value); }
}
public CookieCollection Cookies
{ get; protected set; }
}
public enum CookieNavigationMode
{
Back,
Forward,
New,
Refresh,
Reset
}
}
How can I load http links in xamarin webview?
Upvotes: 1
Views: 1101
Reputation: 71
You need to add this config setting in the AndroidManifest.xml, precisely in the application tag
android:usesCleartextTraffic="true"
This will allow your Android application to load http links; to allow it on iOS is another story – you can find the solution here.
Upvotes: 1