Finally, I succeeded to render MathJax for chats in an Android Browser. Here are the steps:
- Go to play store and install Opera mini.
- After you install the app, open it and go to Bookmarks, Press the 3 dots in the top right corner, press New bookmark.
- 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]);
}
})();
- Type whatever the name you want. I prefer startJax.
- Open your chat page, the chat won't be rendered yet.
- Go to bookmarks, open you saved bookmark, Your chats will be rendered now.