HTMLHyperlinkElementUtils.origin 只读属性是一个 USVString ,其中包含代表URL的原始码的Unicode序列化,即:

  • 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 explicitely 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:" will have "".

Note: 此特性在 Web Worker 中可用


string = object.origin;


// On this page, returns the origin
var result = window.location.origin; // Returns:''


Specification Status Comment
HTML Living Standard
Living Standard Initial definition.

Browser compatibility

BCD tables only load in the browser

See also