HTMLAreaElement.origin

The HTMLAreaElement.origin read-only property is a USVString containing the Unicode serialization of the origin of the represented URL.

That is:

  • for URL using the http or https, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitly specified);
  • for URL using file: scheme, the value is browser dependant;
  • for URL using the blob: scheme, the origin of the URL following blob:. E.g "blob:https://mozilla.org" will have "https://mozilla.org".

Syntax

// Getter
string = area.origin;

// No setter; read-only property

Examples

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

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
origin
8
17
26
Before Firefox 49, results for URL using the blob scheme incorrectly returned null.
No
15
5.1
≤37
18
26
Before Firefox 49, results for URL using the blob scheme incorrectly returned null.
14
5
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLAreaElement/origin