Forum How do I...?

Conditional comment / javascript

larmarange
Hello,

is there a way to tell to Prince XML that a certain peace of code should not be interpreted?

More precisely, I have a HTML document with MathML equations. I want to add in my HTML a link to MathJax javascript for browser compatibility. However, when transforming this document with Prince XML, MathJax causes problem. However, MathJax is not required by prince XML to display properly MathML equation.

So, the best will be to have a way to say to prince XML "don't load and execute MathJax" while MathJax will be properly loaded and executed when the same file will be open in a web browser.
mikeday
You can disable JavaScript entirely if you are not using it for other things in your document. Alternatively, you could wrap the code that loads it in a conditional like this:
if (!Prince) { ... initialise MathJax ... }
larmarange
Thanks a lot, I will try to use !Prince.

Regards
larmarange
Note : the appropriate test is

if (typeof Prince  === "undefined")

Edited by larmarange

mikeday
Right, that's much more better. :D