MDN self-hosted library · e01.org

MathMLAnchorElement: pathname property

MathML

Open notebook · 2 cells web-api-instance-property upstream source

MathML

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:

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

you can get the pathname of the anchor like this:

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

Specifications

Browser compatibility

See also

  • The MathML <a> element