href

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

The href global attribute creates a hyperlink on the MathML element pointing to the specified URL.

Example

The first equation links to the Wikipedia article about the mass-energy equivalence. The square root part of the second equation is a link to the SageMath calculation.

Note: You should avoid nesting MathML elements with the href attributes, just like <a> elements, as is will lead to user confusion and accessibility issues.

html
<math
  display="block"
  href="https://en.wikipedia.org/wiki/Mass-energy_equivalence">
  <mrow>
    <mi>E</mi>
    <mo>=</mo>
    <mi>m</mi>
    <msup>
      <mi>c</mi>
      <mn>2</mn>
    </msup>
  </mrow>
</math>

<math display="block">
  <mi>c</mi>
  <mo>=</mo>
  <msqrt href="https://sagecell.sagemath.org/?z=eJwrLiwq0TCOM9I2iTPSBAAeqgPO">
    <msup>
      <mn>3</mn>
      <mn>2</mn>
    </msup>
    <mo>+</mo>
    <msup>
      <mn>4</mn>
      <mn>2</mn>
    </msup>
  </msqrt>
  <mo>=</mo>
  <mn>5</mn>
</math>

Syntax

html
<math href="https://example.com/">

Values

URL

The URL to which the hyperlink points.

Specifications

The href attribute is not defined in any browser-oriented specification but you can find a description in MathML 4.

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
href
Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 7 (Release date: 2011-09-27)
footnote
footnote See https://hg.mozilla.org/mozilla-central/rev/12294b20e4d9
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote
footnote See https://trac.webkit.org/changeset/203104
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – Full support
Firefox for Android 7 (Release date: 2011-09-27)
footnote
footnote See https://hg.mozilla.org/mozilla-central/rev/12294b20e4d9
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote
footnote See https://trac.webkit.org/changeset/203104
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote
footnote See https://trac.webkit.org/changeset/203104

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
See implementation notes.

See also