Use MathML Elements in OBJECT Tags

Q

How to Use MathML Elements in HTML <object> Tags?

✍: FYIcenter.com

A

If you want to use MathML elements in HTML <object> Tags, you can save MathML elements in .mml files and include MathML file names in the "data" attribute of <object> Tags. You also need to specify the type="application/mathml+xml" attribute in <object> Tags.

You can follow this tutorial to test this.

1. Save the following MathML code in a file called, Einstein-Equation.mml:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mrow>
    <mi>E</mi><mo>=</mo><mi>m</mi><mo>⁢</mo>
    <msup><mi>c</mi><mn>2</mn></msup>
  </mrow>
</math>

2. Save the following HTML document in another file called, object.html:

<html><body>
<p>Einstein famous equation: 
<object style="border: dotted; padding: 10px; width: 1.5in; height: 1.0in;"
  data="Einstein-Equation.mml" type="application/mathml+xml">
</object>
</p>
</body></html>

When you open the above HTML file, object.html, in a Web browser, you may see different behaviors depending on which browser you are using. For example:

  • Firefox v115 blocks the MathML file giving the NS_BINDING_ABORTED error.
  • Safari v12 fails to load MathML file giving no errors.
  • Chrome v103 fails to load MathML file giving no errors.
  • Brave v1.41 fails to load MathML file giving no errors.

Einstein famous equation:  

One way to avoid the loading issue is to rename the MathML file as Einstein-Equation.html and load it as an HTML document as shown below in object-2.html:

<html><body>
<p>Einstein famous equation: 
<object style="border: dotted; padding: 10px; width: 1.5in; height: 1.0in;"
  data="Einstein-Equation.html" type="text/html">
</object>
</p>
</body></html>

Most browsers will display the above HTML file correctly:

Einstein famous equation:  

Also note that, an empty OBJECT tag should be coded as <object ...></object>, not <object .../>.

 

Use MathML Elements in EMBED Tags

"math" - MathML Root Element

Introduction to MathML (Mathematical Markup Language)

⇑⇑ MathML (Mathematical Markup Language)

2026-04-13, ∼1240🔥, 0💬