Loading dynamic html and javascript from assets in a WebView

2
=
0
+
2
2 Bitcoin bounty has been announced by author.
0 has been already awarded by author.
2 remains available.
1

I am trying to display my domain object in a webview. The UI is simple jQuery Mobile. The HTML displays, but the CSS and javascript from the assets folder does not.

I create the WebView like this:

WebView webView = FindViewById<WebView>(Resource.Id.EntityWebView);
webView.Settings.JavaScriptEnabled = true;
webView.SetWebChromeClient(new WebChromeClient());
webView.Settings.DomStorageEnabled = true;
webView.LoadData(getMy.Html(), "text/html", "UTF-8");

My html, that is created on the fly is displayed, but the CSS and JS from jQuery is not. I reference it like this:

<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1'> 
<link rel='stylesheet' href='file:///android_asset/html/jquery.mobile.css' />
<script src='file:///android_asset/html/jquery.js' type='text/javascript'></script>
<script src='file:///android_asset/html/jquery.mobile.js' type='text/javascript'></script>
</head>

The files are markets as AndroidAssets

User rating:

1212121212121

User rating:
Test unsubscribe
User rating:

0 answers

0
=
0
=
$0
Internet users could send Bitcoin Tips to you if they like your answer!

Too many commands? Learning new syntax?

FavScripts.com is a free tool to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.

Boost your productivity with FavScripts.com!

Post Answer