origin
グローバルの origin
プロパティは読み取り専用で、文字列としてシリアライズされた、グローバルスコープのオリジンを返します。
値
文字列です。
例
ワーカースクリプト内から以下のスニペットを実行すると、メッセージを受け取る度にワーカーのグローバルスコープのオリジンをコンソールに記録します。
js
onmessage = () => {
console.log(self.origin);
};
もしオリジンがスキーム/ホスト名/ポート番号の組み合わせでない場合(すなわち、ローカルで実行しようとしている、つまり file://
の URL の場合)、 origin
は "null"
という文字列を返すでしょう。
仕様書
Specification |
---|
HTML # dom-origin-dev |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
origin |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.