I've developed a small application with WebView in Xamarin, it loads the page correctly, but is not running JavaScript, JavaScript with webView.Settings.JavaScriptEnabled = true;
but no success, I have no experience with Xamarin , do I need to do anything else?
MainActivity.cs
[Activity(MainLauncher = true, Theme = "@android:style/Theme.NoTitleBar.Fullscreen")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
var webView = FindViewById<WebView>(Resource.Id.webView);
// Use subclassed WebViewClient to intercept hybrid native calls
webView.SetWebViewClient(new HybridWebViewClient());
webView.Settings.JavaScriptCanOpenWindowsAutomatically = true;
webView.Settings.JavaScriptEnabled = true;
webView.LoadUrl("http://financas.gopagoda.io");
}
private class HybridWebViewClient : WebViewClient
{
public override bool ShouldOverrideUrlLoading(WebView webView, string url)
{
// If the URL is not our own custom scheme, just let the webView load the URL as usual
var scheme = "hybrid:";
if (!url.StartsWith(scheme))
return false;
// This handler will treat everything between the protocol and "?"
// as the method name. The querystring has all of the parameters.
var resources = url.Substring(scheme.Length).Split('?');
var method = resources[0];
var parameters = System.Web.HttpUtility.ParseQueryString(resources[1]);
return true;
}
}
}
Main.axml
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView" >
</WebView>
I get this error in the console:
"jQuery.Deferred exception: Can not read property 'getItem' of null", source: link (2 ) [INFO: CONSOLE (2)] "Uncaught TypeError: Can not read property 'getItem' of null", source: link