WorkerLocation: hostname プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

We'd love to hear more about your role and the company you work for
Please help us by answering a few questions.

hostnameWorkerLocation オブジェクトのプロパティで、ワーカーの位置のホスト名 (hostname) の部分を返します。

文字列です。

js
// http://localhost:8080/ のページにあるウェブワーカーにて
const result = location.hostname; // 'localhost' を返す

仕様書

Specification
HTML
# dom-workerlocation-hostname

ブラウザーの互換性

関連情報