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).

Value

A string.

Examples

Basic usage

Given this HTML:

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

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