My notebook with some math notes

MathML support in chromium based browsers


2 - 3 minutes read, 555 words
Categories: web
Keywords: chromium firefox javascript math web

MathML is the subset of HTML5 for writing and rendering mathematical formulas, like the quadratic formula:

x = b ± b 2 4 a c 2 a x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} x={-b plusminus sqrt {b^2 - 4 ac}} over {2 a}

But if you are using a browsers based on Chromium, like Google Chrome, Brave, Opera, Vivaldi, Microsoft Edge and so on, then chances are that you are not visualizing the previous formula correctly.

I’ve noticed this after rereading some of my notes about ODE with a chromium-based browser.

Support for MathML

Wikipedia has a good overview about which browser does support MathML, you will notice that chromium used to support it, but then decided to drop it.

It’s frustrating because today browsers are adding extensions for a lot of technologies that have nothing to do with viewing websites, like access to the microphone, camera, GPS location, notifications, and USB drives, or alternative formats like AMP, but fail to add a standardized a part of HTML5 has been there for years.

MathJax has the fundamental issue that as it is javascript code, can do pretty much anything. It also requires downloading extra resources, fonts, and probably most of the time only a tiny fraction of it is required.

Alternative to MathML

An obvious solution to the problem is avoiding MathML entirely and use something else.

"Something else" would be a javascript library, like MathJax.

It has multiple advantages, like

  • supports MathML

  • supports (a subset of) LaTeX

  • works on mainstream browsers/operating systems

But, like all javascript libraries, has disadvantages too:

  • it is an additional resource that the end-user needs to download

  • it needs to be kept updated to avoid potential security issues (it is code that gets executed after all)

  • it means executing untrusted code (as it is code that’s downloaded from a website you do not necessarily trust that much) on your pc.

  • relying on Javascript (and other dynamic languages) makes it harder to test a website statically. One generally needs to execute the code before knowing how the page will look like.

As an end-user, I’m very happy when a website does not require javascript to work correctly. It would be incoherent to make an exception for what I put on my personal websites.

Possible solutions

A possible solution is letting the end-user injecting MathJax on the pages with a MathML formula.

There is, in fact, at least one plugin for chromium-based browsers that claim to do that: FMath. It seems to do a good job, but just like any additional program, it is hard to tell if it is trustworthy, or if future version will contain malware, like it happened multiple times.

Of course, it is better than having all websites providing their own, possibly outdated, version of MathJax or through a CDN, as it is more difficult to ensure the trustworthiness of what is executed, and will consume more resources.

Another solution is to switch to another browser. I mainly use Firefox so I only noticed the issue by accident. Proposing to change browser might be too much to ask, but it is the only one putting some effort into supporting MathML.

This shows that diversity is a good thing, but unfortunately, as of today, most browsers have a common ancestor.


Do you want to share your opinion? Or is there an error, same parts that are not clear enough?

You can contact me here.