WeBWorK Main Forum

MathJax not rendering

MathJax not rendering

by Xiao Xiao -
Number of replies: 4
Hello! I am currently trying to push my instituion to host WebWork locally so I need to first install it myself to get familar with the process. I install the Virtual Machine image on my QNAP NAS system at home.

After I installed and updated everything, MathJax is not working as I would like to. If I use the Firefox in the Virtual Machine, all math are rendered OK with MathJax or images. If I used another computer (both my Mac and PC), I can get the math to show up correctly if I choose images. But if I choose MathJax, I only see [math] in both homework envrionment as well as Problem Library environment. I have tried all browsers (FireFox, Chrome, Safari).

When I tried to use Javascript Console in Firefox, I see the following error message:

The script from “http://192.168.1.10/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.


Anyone has any idea what might be wrong here? Thanks in advance!
In reply to Xiao Xiao

Re: MathJax not rendering

by Nathan Wallach -
From a suitable machine with access to your server try downloading the file with wget and see what happens:

wget http://192.168.1.10/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full

and check what response is sent and what MIME type is give to the file? If you are really seeing the MIME type as "text/html" and the JavaScript code was downloaded, then there is probably some error in the server configuration.

Sample from a server of mine:


tani@lxtani:/tmp$ wget https://webwork.technion.ac.il/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full


--2019-09-16 15:37:38-- https://webwork.technion.ac.il/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full
Resolving webwork.technion.ac.il (webwork.technion.ac.il)... 132.69.247.179
Connecting to webwork.technion.ac.il (webwork.technion.ac.il)|132.69.247.179|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 63551 (62K) [application/javascript]
Saving to: ‘MathJax.js?config=TeX-MML-AM_HTMLorMML-full’

MathJax.js?config=TeX-MML-AM_HTMLorMML-ful 100%[=====================================================================================>] 62.06K --.-KB/s in 0.001s

2019-09-16 15:37:38 (50.8 MB/s) - ‘MathJax.js?config=TeX-MML-AM_HTMLorMML-full’ saved [63551/63551]

Note that there seems to be different opinions about whether to use "application/javascript" or "text/javascript" as the proper MIME type, but "text/html" is certainly not correct for JavaScript code.
In reply to Nathan Wallach

Re: MathJax not rendering

by Xiao Xiao -
Thank you very much for responding! I did what you suggested and I got:

ITS10151MLF:~ xiao$ wget http://192.168.1.10/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full

--2019-09-16 17:46:50-- http://192.168.1.10/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full

Connecting to 192.168.1.10:80... connected.

HTTP request sent, awaiting response... 404 Not Found

2019-09-16 17:46:50 ERROR 404: Not Found.


So it seems like the link is not working. Any suggestions what setting might be wrong on the server?

In reply to Xiao Xiao

Re: MathJax not rendering

by Nathan Wallach -
It looks like MathJax is not actually installed in the VM you set up, or not in the location where it is being accessed. I'm not sure what VM you set up, sorry.

You might find it easier to set up a Docker based server, which makes it pretty easy to set up a development or a production server. The Docker configuration essenially builds a "container" (really 3 containers) with a complete fully functioning WW server. See:
however, I could recommend that just before you run docker build you do
git checkout WeBWorK-2.15
as the soon to be released WW 2.15 has many improvements to the Docker setup (and more to be merged soon) as in WW 2.15.