-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add try/catch around do_user_agent_identification(); [was: Should stop relying on navigator.appVersion] #1155
Comments
Putting aside the (eternal) discussion about browser sniffing, I'm not seeing any errors on FF 37.0.1, ubuntu 14.10. Do you get the error when visiting that particular sample? |
Yes Apparently the issue is slightly more complex: that issue affects Firefox 37 on Ubuntu 15.04 (which is in late Beta after Kernel Freeze, a few days before the RC), but now I tried to reproduce it again on Ubuntu 14.10, and MathJax works just fine. Moreover,
Which is exactly the same as on Ubuntu 15.04, so I'm quite stumped. :/ |
Thanks for following up on this. That's rather strange. I'll try to reproduce this on a clean 15.04 VM. |
Hm. I spun up the daily build live CD of Ubuntu Gnome. It ships Firefox 37.0.0 and does not show any trouble. Do you have any extensions installed that might interfere? |
No extensions enabled except the default Ubuntu ones, I even reproduced the issue by running Firefox in Safe Mode |
@berdario, the line you indicate should only be executed by WebKit browsers, so shouldn't apply to Firefox. What is your |
Ugh, you're right... it was
Turns out that in 2015 there are still some websites that do user agent filtering to prevent access to websites, I tweaked it some time ago and then forgot about it -_- I guess that on one hand this could be filed under PEBKAC, but otoh, it'd be better if the user-agent sniffing code was a bit more robust... by looking at the code it's just mostly used to identify the exact version of the browser. If it's not critical for MathJax behavior I guess a simple
Might be good to add Anyhow, before looking again at this, I was trying to run MathJax in development mode (that is, without packing everything), but I couldn't find any instructions in the documentation (it expects me to use the prebuilt Not even CONTRIBUTING mentions how to run it in dev mode... is it possiible to add a couple lines? |
For the code suggestion, @dpvc what are your thoughts? For the documentation part, it's a long standing issue that we don't have good documentation for developers (for mainly historic reasons). I've opened #1162 and mathjax/MathJax-docs#100 |
I don't have a problem with putting a try/catch around the relevant code. |
Ok, I've added this in the |
==> Merged |
I'm getting the navigator null error on Firefox 75.0 (64-bit) on Windows 10. I'm using MathJax 2.7.8. I then tried 2.6.0, the version when it was fixed. But with this version I get the following error:
|
@arvindpdmn, I am not able to reproduce your problem. Firefox 75 works fine for me on Windows 10. Can you give the actual error message that you are receiving? As for 2.6.0, it appears that there is no npm package for that version (but there is for 2.6.1). You can see the versions that npm has available using the versions tab here. You can get 2.6.0 from GitHub instead, using
if you wish. The reason you are getting the error message you indicated for this (about text/plain) is that jsdelivr returns an error page for version 2.6.0 that is a plain text page, rather than the javascript that the browser was expecting. |
I'm not able to reproduce the problem today! There's no error on Firefox 75 on Windows10 on 2.7.1, 2.7.8 or 2.6.1. The error message I was getting yesterday with 2.7.1 via Cloudflare (or 2.7.8 via jsdelivr.net):
Perhaps something in my code was triggering this. Need to look into this later. |
There is only one line where this could be coming from, and that is in the handling of the Safari browser. That suggests that there is something strange about the browser string that you are using. What is the value of Also, what is the value of In any case, all of the |
OK, thanks. That all looks as it should. Can you use
(not the |
But I don't get any error today like I did yesterday. However, I will use the |
From MDN
And indeed this is starting to cause problems on my Firefox 37, Ubuntu. I have the following
navigator.appVersion
:For comparison, on Chrome it's:
This causes a
TypeError: navigator.appVersion.match(...) is null
I assume at this line:
(navigator.appVersion.match(/WebKit\/(\d+)\./)) [1]
(unfortunately the sample uses the minified mathjax, and thus it's not so simple to discover where it's failing)The text was updated successfully, but these errors were encountered: