WorkerLocation: hostname 属性
注意:此功能仅在 Web Workers 中可用。
WorkerLocation 对象的 hostname 属性返回工作线程位置的 hostname 部分。
值
字符串。
示例
js
// In a Web worker, on the page https://:8080/
const result = location.hostname; // Returns 'localhost'
规范
| 规范 |
|---|
| HTML # dom-workerlocation-hostname |
浏览器兼容性
加载中…
另见
- 它所属的
WorkerLocation接口。