Skip to content

Instantly share code, notes, and snippets.

@Kimserey
Created November 25, 2015 00:16
Show Gist options
  • Select an option

  • Save Kimserey/e0b0a8e415681dd6f979 to your computer and use it in GitHub Desktop.

Select an option

Save Kimserey/e0b0a8e415681dd6f979 to your computer and use it in GitHub Desktop.
WebView for Xamarin Android in F#
<?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" />
namespace App2
open System
open Android.App
open Android.Content
open Android.OS
open Android.Runtime
open Android.Views
open Android.Widget
open Android.Webkit
[<Activity (Label = "App2", MainLauncher = true)>]
type MainActivity () =
inherit Activity ()
let mutable webView: WebView = null
override this.OnCreate (bundle) =
base.OnCreate (bundle)
// Set our view from the "main" layout resource
this.SetContentView (Resource_Layout.Main)
webView <- this.FindViewById<WebView>(Resource_Id.webview)
webView.SetWebChromeClient(new WebChromeClient());
webView.Settings.JavaScriptEnabled <- true
webView.Settings.DomStorageEnabled <- true
webView.Settings.AllowFileAccess <- true
webView.Settings.AllowFileAccessFromFileURLs <- true
webView.Settings.AllowUniversalAccessFromFileURLs <- true
webView.Settings.JavaScriptEnabled <- true
webView.Settings.SaveFormData <- false
webView.LoadUrl "file:///android_asset/index.html"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment