Android webview +javascript not showing output in android 4.0.x,3.x Android webview +javascript not showing output in android 4.0.x,3.x android android

Android webview +javascript not showing output in android 4.0.x,3.x


I had a similar problem. What I did was I copied all the .js files in the same directory as where the html is and added it as follows.

<script type="text/javascript" src="MathJax.js"></script>

I know it sounds a bit stupid, but it worked.

If that doesn't work, copy the .js file into the html file itself and try it like in the header:

<script type="text/javascript">copy the whole MathJax.js and paste it here</script>


Some people already had this problem (actually... a lot of them...).

One post (and also one answer) got my attention : https://stackoverflow.com/a/7197748/1387484

It appears you have to inject your Javascript call in the WebViewClient manually, after the document was fully loaded. I doesn't have more explanation but maybe you can try this way !


It seems the problem is related to this android bug. If you are referencing files with url parameters a HTTP 404 (file not found) occurs, in your case the script "MathJax.js?config=AM_HTMLorMML-full" will not be found and therfor not loaded.

Overcoming Honeycomb and Ice Cream Sandwich’s Broken WebView URLs

<!-- hack for honeycomb & ICS -- first script tag will not load but it's --><!-- needed for proper MathJax initialisation - clean solution would be to --><!-- pass the init data "AM_HTMLorMML-full" in some other way to MathJax --><script type="text/javascript" src="../MathJax.js?config=AM_HTMLorMML-full"></script><script type="text/javascript" src="../MathJax.js"></script>