Issues with Internet Explorer, at least versions 11 and 12

154 views
Skip to first unread message

mig...@t-online.de

unread,
Mar 31, 2015, 7:55:39 AM3/31/15
to mathja...@googlegroups.com
IE fails to render MathJax formulas in some, but not all pages, and sometimes, but not always even with the same page, gives a JS syntax error in a correct statement. This problem was detected these days, while tests made more than a year ago using MathJax < 2.4 installed in our server went ok.

The syntax error when using the MathJax CDN is shown in the console as:
SCRIPT 1002: syntax error
File: MathJax.js, Line: 19, Column: 3359

while in the debugger the following statement
 var EVAL=function(code){return(eval.call(window,code)};
has the return highlighted

Sample pages
- without issues:
-- the MathJax site pages
-- from our server, using MathJax from our server
 http://www.atractor.pt/mat/SteinerHexlet/index.html

- with issues:
-- from our server
 http://www.atractor.pt/mat/ABC-CBA/index.html - MathJax from our server
 http://www.atractor.pt/mat/ABC-CBA/z.html - a copy of SteinerHexlet/index.html
 http://www.atractor.pt/mat/ABC-CBA/zzz.html - same using MathJax CDN no config parameter
 http://www.atractor.pt/mat/ABC-CBA/z4.html - same using MathJax CDN and config parameter

-- "TeX Commands available in MathJax", using MathJax CDN
 http://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm

As SteinerHexlet/index.html is ok but not its copy in a different directory lacking the images in the page, it may happen the delay by this error makes IE behave differently. However this does not explain why IE fails on ABC-CBA/index.html

MathJax versions for local pages: 2.4 and also 2.5.1 installed in our server today.
OS: MS Windows 7 Enterprise
IE: 11.0.9600.17691, updates 11.0.17 (KB3032359) [also in version 12, but I have no detailed information]

Thanks in advance for any help on this,
Miguel Filgueiras

mig...@t-online.de

unread,
Mar 31, 2015, 11:42:18 AM3/31/15
to mathja...@googlegroups.com, mig...@t-online.de


terça-feira, 31 de Março de 2015 às 12:55:39 UTC+1, mig...@t-online.de escreveu:

It seems the problem is solved by deleting the HTML comment delimiters in the
text/x-mathjax-config
script. Was there any change in the last 2 or 3 versions of MathJax that caused this?

Meanwhile some of the sample pages have moved: they are now in http://www.atractor.pt/mat/MJaxtest/

 http://www.atractor.pt/mat/MJaxtest/index.html - MathJax from our server
 http://www.atractor.pt/mat/MJaxtest/z.html - a copy of SteinerHexlet/index.html
 http://www.atractor.pt/mat/MJaxtest/zzz.html - same using MathJax CDN no config parameter
 http://www.atractor.pt/mat/MJaxtest/z4.html - same using MathJax CDN and config parameter

Peter Krautzberger

unread,
Apr 1, 2015, 6:02:01 AM4/1/15
to mathja...@googlegroups.com, Miguel Filgueiras
Hi Miguel,

Glad to see you could resolve your issue. 

Having html comments in JavaScript can cause erratic behavior, in particular in xhtml (though in your case the server actually serves it as html which in turn can cause other problems).

Was there any change in the last 2 or 3 versions of MathJax that caused this?

Possibly. IE 11 was released around the time MathJax v2.3 came out. It might also be that IE 11 behaves differently with respect to comments in JS or with the xhtml-with-html-header but I don't know.

Regards,
Peter.
 

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mig...@t-online.de

unread,
Apr 1, 2015, 10:36:55 AM4/1/15
to mathja...@googlegroups.com, mig...@t-online.de
Hi Peter,

Thanks a lot for your reply.

The use of HTML comment delimiters to surround the Javascript code is recommended by W3C in
http://www.w3.org/TR/html401/interact/scripts.html#h-18.3.2
That is why we decided to use them after seeing that the W3C validator tried to parse the code as HTML.
But if the MathJax configuration is broken by this we can easily put it in a file and use the src
attribute.

Note also that  the "TeX Commands available in MathJax" page I mentioned in my first post does not
use these delimiters and so the errors in it are not solved. Maybe you wish to contact its author.

Thanks again,
Regards,
Miguel

Davide P. Cervone

unread,
Apr 2, 2015, 6:38:42 AM4/2/15
to mathja...@googlegroups.com
The use of HTML comment delimiters to surround the Javascript code is recommended by W3C in
http://www.w3.org/TR/html401/interact/scripts.html#h-18.3.2

That page is from 1999, and much has happened in the 15 years since then.  In particular, in those days, not all browsers understood <script> tags, and those that didn't would display the script as part of the get of the page.  Those comments were used to prevent that, but unless your readers are using a browser from a previous century, there is no reason for those comments any longer.  At least for HTML pages.

For XHTML, the situation is slightly different, because in HTML, the contents of <script> tags are CDATA automatically, but that is not the case for XHTML.  To prevent scripts from being parsed in XHTML, you need to indicate that they are CDATA, using a CDATA comment.  The recommended way is to use

<script>
  //<![CDATA[
  ... your javascript here ...
  //]]>
</script>

These are needed for an entirely different reason from the unnecessary comments that you were using, and note that they are valid javascript comments (not HTML comments, which are not valid in javascript).  MathJax will ignore these properly even if you use them in HTML (which does not support CDATA comments).

In any case, you haven't quite followed the recommendation you cite, as it should be

<script>
  <!--
  ... your javascript here ...
  //-->
</script>

where the final "-->" is commented out.  If you really feel the need to use such comments, anachronistic though they are, you could do

<script>
  //<!--
  ... your javascript here ...
  //-->
</script>

which will work properly with MathJax since it is at least valid javascript.  I'm not sure if that works in XHTML or not, though.

But if the MathJax configuration is broken by this we can easily put it in a file and use the src
attribute.

You would need to use the alternative

MathJax = {
  ... your configuration here ...
};

configuration syntax if you do, and use a standard <script type="text/javascript"> script rather than type="text/x-mathjax-config" for that.

Note also that  the "TeX Commands available in MathJax" page I mentioned in my first post does not
use these delimiters and so the errors in it are not solved. Maybe you wish to contact its author.

The problem there is that the page specifies IE=EmulateIE7, and since the fast preview doesn't work with IE7, that is causing the errors.  It is unrelated to your issue.

Davide

mig...@t-online.de

unread,
Apr 6, 2015, 12:24:41 PM4/6/15
to mathja...@googlegroups.com, dp...@union.edu

Hi Davide,

Thank you very much for your detailed explanation. I think I will use a file for the configuration in the new syntax.

Regards,
Miguel

Reply all
Reply to author
Forward
0 new messages