HTMLAnchorElement: origin property - Web APIs | MDN (original) (raw)

Baseline Widely available

The**HTMLAnchorElement.origin** read-only property is a string containing the Unicode serialization of the origin of the represented URL.

That is:

Value

A string.

Examples

// An <a id="myAnchor" href="https://developer.mozilla.org/en-US/HTMLAnchorElement"> element is in the document
const anchor = document.getElementById("myAnchor");
anchor.origin; // returns 'https://developer.mozilla.org'

Specifications

Specification
HTML Standard # dom-hyperlink-origin-dev

Browser compatibility

BCD tables only load in the browser

See also