Skip to main content

Finally, I succeeded to render MathJax for chats in ANDROID Browser. Here are the steps

  1. Go to play store and install Opera mini.
  2. After you install the app, open it and go to Bookmarks, Press the 3 dots in the top right corner, press New bookmark.
  3. Paste the following javascript code in the field for URL.
javascript: (function() {
    if (window.MathJax === undefined) {
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML";
        var config = 'MathJax.Hub.Config({' + 'extensions: ["tex2jax.js"],' + 'tex2jax: { inlineMath: [["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true },' + 'jax: ["input/TeX","output/HTML-CSS"]' + '});' + 'MathJax.Hub.Startup.onload();';
        if (window.opera) {
            script.innerHTML = config
        } else {
            script.text = config
        }
        document.getElementsByTagName("head")[0].appendChild(script);
        (doChatJax = function() {
            window.setTimeout(doChatJax, 1000);
            MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
        })();
    } else {
        MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
    }
})();
  1. Type whatever the name you want. I prefer startJax.
  2. Open your chat page, the chat won't be rendered yet. Goto bookmarks then open you saved bookmark. Your chats will be rendered now.
user404249