1
現在我編寫了Android程序。此應用程序必須使用MathJax庫將Form FORM呈現給WebView。但我有問題......有時它不工作(形式不定期)... 現在來源:MathJax渲染Android
// This function calls everytime before output
public static void clearWebView()
{
w.loadDataWithBaseURL("http://bar", "<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no\"> <script type='text/x-mathjax-config'>"
+"MathJax.Hub.Config({ "
+"showMathMenu: false, "
+"jax: ['input/TeX','output/HTML-CSS'], "
+"extensions: ['tex2jax.js'], "
+"TeX: { extensions: ['AMSmath.js','AMSsymbols.js',"
+"'noErrors.js','noUndefined.js', 'MathZoom.js'" +
"] } "
+"});</script>"
+"<script type='text/javascript' "
+"src=\"file:///android_asset/MathJax/MathJax.js\""
+"></script></head><body><span id='solve'></span></body></html>" ,"text/html","utf-8", "");
}
和兩個渲染功能:
public static void RenderHTML(String html)
{
w.loadUrl("javascript:document.getElementById('solve').innerHTML += '" + html + "';");
}
public static void RenderMath(String tex)
{
RenderHTML("\\\\[" + doubleEscapeTeX(tex) + "\\\\]");
w.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
}
我爲我的應用程序使用相同的代碼並面臨Android 4.4上的問題。它在Android 4.3及更低版本上爲我工作。 – 2013-12-14 10:50:20
這是我在4.4上遇到的問題,http://stackoverflow.com/questions/20582282/uncaught-referenceerror-while-loading-asset-file-on-android-4-4 – 2013-12-14 11:12:48