Search code examples
c#wpfvisual-studio-2012mathjaxmathml

Using MathML and JavaScript inside WebBrowser component


I have the following webpage in HTML using MathML. In my Firefox, this displays a nice mathematical equation $a x^2 + b x + c$, as MathML should.

I figured I could now load this webpage into the WebBrowser of my Visual Studio 2015 WPF Application. However, the MathML does not render as expected. I suppose the WebBrowser component is not capable of dealing with MathML.

I have a second webpage using JavaScript, which I need for similar reasons. This, too, works in Firefox but not inside the WebBrowser of Visual Studio.

Any suggestions?

<html>
<head>
<title>
Title
</title>
</head>

<body>

MathML:

<br>

<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<mi>a</mi>
<mo>&InvisibleTimes;</mo>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<mi>b</mi>
<mo>&InvisibleTimes; </mo>
<mi>x</mi>
<mo>+</mo>
<mi>c</mi>
</mrow>
</math>

</body>
</html>

Solution

  • MathML is not yet supported by the WebBrowser in Visual Studio (probably IE). Math can be typeset using CSS and javascript. A webpage would then need to include

    <!-- saved from url=(0014)about:internet -->
    

    in order not to get the pop-up "Allow blocked content".