WorkerGlobalScope: origin プロパティ
origin
は WorkerGlobalScope
インターフェイスの読み取り専用プロパティで、グローバルスコープのオリジンを文字列でシリアライズして返します。
値
文字列です。
例
ワーカースコープの内部から以下のスニペットを実行すると、メッセージを受信するたびにワーカーのグローバルスコープの元をコンソールにログ出力します。
js
self.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.