W3cubDocs

/Web APIs

HTMLAreaElement: origin property

The HTMLAreaElement.origin read-only property is a string 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 dependent;
  • for URL using the blob: scheme, the origin of the URL following blob:. E.g "blob:https://mozilla.org" will have "https://mozilla.org".

Value

A string.

Examples

js

// 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 32 17
26Before Firefox 49, results for URL using the blob scheme incorrectly returned null.
No 19 10 ≤37 32
26Before Firefox 49, results for URL using the blob scheme incorrectly returned null.
19 10 2.0

See also

© 2005–2023 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