manav patadia
manav patadia

Reputation: 81

mathjax for api >=19

mathjax for mathml works like a charm in all mobiles having api<19 but i have a tablet and i having problem in reloading data in the webview i.e It loads mathml for the 1st time but when i re-load another mathml code in the same webview the content don't get change...the code is

wq.getSettings().setJavaScriptEnabled(true);
        wq.getSettings().setBuiltInZoomControls(true);
        wq.getSettings().setLoadWithOverviewMode(true);
        wq.loadDataWithBaseURL("http://bar", "<script type='text/x-mathjax-config'>"
                +"MathJax.Hub.Config({ "
                +"showMathMenu: false, "
                +"jax: ['input/MathML','output/HTML-CSS'], " // output/SVG
                +"extensions: ['mml2jax.js'], "
                +"TeX: { extensions: ['noErrors.js','noUndefined.js'] }, "
                //+"'SVG' : { blacker: 30, "
                // +"styles: { path: { 'shape-rendering': 'crispEdges' } } } "
                +"});</script>"
                +"<script type='text/javascript' "
                +"src='file:///android_asset/MathJax/MathJax.js'"
                +"></script><span id='text'> </span> <span id='math'></span>", "text/html", "utf-8", "");
if (android.os.Build.VERSION.SDK_INT < 19)
        {
            wq.loadUrl("javascript:document.getElementById('math').innerHTML='"
                + "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
                + "<mstyle displaystyle=\"true\">"
                + doubleEscapeTeX(questn)
                + "</mstyle></math>';");
            wq.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
        }
        else
        {
            wq.loadUrl("javascript:document.getElementById('math').innerHTML='"
                    + "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
                    + "<mstyle displaystyle=\"true\">"
                    + doubleEscapeTeX(questn)
                    + "</mstyle></math>';");              wq.evaluateJavascript("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);",null);
        }

please help. Thanx in advance

Upvotes: 1

Views: 276

Answers (1)

manav patadia
manav patadia

Reputation: 81

I got the Sollution...

    void loadwebview()
        {
            wq.getSettings().setJavaScriptEnabled(true);
            wq.getSettings().setBuiltInZoomControls(true);
            wq.getSettings().setLoadWithOverviewMode(true);
            wq.loadDataWithBaseURL("**http://bar/**", "<script type='text/x-mathjax-config'>"
                    +"MathJax.Hub.Config({ "
                    +"showMathMenu: false, "
                    +"jax: ['input/MathML','output/HTML-CSS'], " // output/SVG
                    +"extensions: ['mml2jax.js'], "
                    +"TeX: { extensions: ['noErrors.js','noUndefined.js'] }, "
                    //+"'SVG' : { blacker: 30, "
                    // +"styles: { path: { 'shape-rendering': 'crispEdges' } } } "
                    +"});</script>"
                    +"<script type='text/javascript' "
                    +"src='file:///android_asset/MathJax/MathJax.js'"
                    +"></script><span id='text'> </span> <span id='math'></span>", "text/html", "utf-8", "");
    }
    void insertdata(String questn)
    {
    if (android.os.Build.VERSION.SDK_INT < 19)
            {
                wq.loadUrl("javascript:document.getElementById('math').innerHTML='"
                    + "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">"
                    + "<mstyle displaystyle=\"true\">"
                    + doubleEscapeTeX(questn)
                    + "</mstyle></math>';");
                wq.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
            }
            else
            {
                wq.evaluateJavascript("javascript:document.getElementById('math').innerHTML='<font color=\"#000000\">`"+doubleEscapeTeX(questn)+"`</font>';",null);
                wq.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);");
            }
}

Upvotes: 1

Related Questions