numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
207 stars 122 forks source link

Can't find variable: MathJax #562

Closed samfearn closed 5 years ago

samfearn commented 6 years ago

I'm having some problems getting Numbas to load correctly. If I try to visit https://www.numbas.org.uk/demos/frontpage-demo/, then I get an error regarding MathJax not being found. I'm actually trying to get Numbas working on my own personal page, but I get the same error there. Specifically, I can see a console log:

[Log] Numbas couldn't start because the file <code>mathjax-hooks</code> was not loaded. Check that it's included in <code>scripts.js</code>. (numbascommon.js, line 207)

Given that I seem to have the same error on your demo page I assume it's not anything I'm doing?

samfearn commented 6 years ago

Ok, if I clear my caches, Numbas loads once. Then fails to load on refresh. Works again once if I clear caches before stopping again, so maybe this is a local issue? FWIW I'm on Safari 11.1.2 on MacOS High Sierra 10.13.6. I get a similar problem on my phone, which is an iPhone 6 running up-to-date mobile Safari. Just got a friend to check and he has similar problems on his iPhone too.

christianp commented 6 years ago

Sounds like a problem with Safari. I'll try to find someone with a Mac so I can reproduce it.

christianp commented 6 years ago

Sorry, that's not true at all: it was an old exam that was still trying to load MathJax from cdn.mathjax.org! Fixed now, and thank you very much for reporting this.

samfearn commented 6 years ago

Ok, I see you've now changed it to be using MathJax 2.7.0. I'm getting the same error about MathJax not being found on the page I'm building which uses Numbas. I'm trying to work out what I've done to break things and one thing I did was to use the latest MathJax 2.7.4. The error doesn't seem to go away if I change back to 2.7.0, but is there a reason to use the outdated MathJax?

christianp commented 6 years ago

Oh, that's a good point. I forgot I need to update the URL each time there's a new MathJax release. Can you give me a link to the page you're getting errors on, or email it to christian.perfect@ncl.ac.uk?

samfearn commented 6 years ago

I'm sure you're aware, but you can just use https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/latest.js?config=TeX-AMS-MML_HTMLorMML, and even though it explicitly references 2.7.4, it will automagically reference the most recent update.

The page I'm having problems on is still a work in progress, so the only publicly available version is a bit behind my private copy, but both have similar (though not quite identical) errors of this type. Happy to share a link though: http://www.maths.dur.ac.uk/~sxwc62/playground/

Edit: On the page I've linked, I have the same effect as I described above - I can get it to load once, then if I refresh the page I get the error until I clear caches. Somehow on my local copy I've made it worse and it won't even load once.

samfearn commented 6 years ago

By the way - this should really be a separate issue, but it's linked to that demo page and isn't overly important - the link to numbas at the bottom of the demo page, and the link to numbas included if one downloads the standalone html page for a question contains a dead link to http://www.ncl.ac.uk/maths/numbas, I imagine you might want to update it to https://www.numbas.org.uk

christianp commented 6 years ago

I think that I'd like to stick with explicitly named versions, just in case there's another breaking change somewhere down the line.

Thanks for the link to that playground page - I get the same problem. I suspect the problem is to do with being embedded in an iframe - I'll try to find out if that's the case, and if I can do anything to fix it.

christianp commented 6 years ago

Hah, I incorrectly made another assumption: that's not an iframe. It looks like you're trying to do something clever. Can you send me an email explaining what you're trying to do?

samfearn commented 6 years ago

Yeh there's no iframes going on. I've sent you an email with the details.