MathMLAnchorElement: pathname property

The pathname property of the MathMLAnchorElement interface is a string containing an initial '/' followed by the path of the URL not including the query string or fragment (or the empty string if there is no path).

See URL.pathname for more information.

Value

A string.

Examples

Basic usage

Given this MathML:

html
<math>
  <a id="myAnchor" href="https://example.com/subsection#examples"> ... </a>
</math>

you can get the pathname of the anchor like this:

js
const mathAnchor = document.getElementById("myAnchor");
mathAnchor.pathname; // returns '/subsection'

Specifications

Specification
HTML
# dom-hyperlink-pathname

Browser compatibility

See also

  • The MathML <a> element