origin

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

グローバルの origin プロパティは読み取り専用で、文字列としてシリアライズされた、グローバルスコープのオリジンを返します。

文字列です。

ワーカースクリプト内から以下のスニペットを実行すると、メッセージを受け取る度にワーカーのグローバルスコープのオリジンをコンソールに記録します。

js
onmessage = () => {
  console.log(self.origin);
};

もしオリジンがスキーム/ホスト名/ポート番号の組み合わせでない場合(すなわち、ローカルで実行しようとしている、つまり file:// の URL の場合)、 origin"null" という文字列を返すでしょう。

仕様書

Specification
HTML
# dom-origin-dev

ブラウザーの互換性