WorkerLocation
interface defines the absolute location of the script executed by the
Worker
. Such an object is initialized for each worker and is available via the
WorkerGlobalScope.location
property obtained by calling
self.location
.
This interface is only visible from inside a JavaScript script executed in the context of a Web worker.
WorkerLocation
interface doesn't inherit any property, but implements properties defined in the
URLUtilsReadOnly
接口。
URLUtilsReadOnly.href
只读
DOMString
containing the whole URL of the script executed in the
Worker
.
URLUtilsReadOnly.protocol
只读
DOMString
containing the protocol scheme of the URL of the script executed in the
Worker
, including the final
':'
.
URLUtilsReadOnly.host
只读
DOMString
包含主机,即
hostname
,
':'
,和
port
of the URL of the script executed in the
Worker
.
URLUtilsReadOnly.hostname
只读
DOMString
containing the domain of the URL of the script executed in the
Worker
.
URLUtilsReadOnly.origin
只读
DOMString
containing the canonical form of the origin of the specific location.
URLUtilsReadOnly.port
只读
DOMString
containing the port number of the URL of the script executed in the
Worker
.
URLUtilsReadOnly.pathname
只读
DOMString
包含初始
'/'
followed by the path of the URL of the script executed in the
Worker
.
URLUtilsReadOnly.search
只读
DOMString
包含
'?'
followed by the parameters of the URL of the script executed in the
Worker
.
URLUtilsReadOnly.hash
只读
DOMString
包含
'#'
followed by the fragment identifier of the URL of the script executed in the
Worker
.
WorkerLocation
interface doesn't inherit any method, but implements methods defined in the
URLUtilsReadOnly
接口。
URLUtilsReadOnly.toString()
DOMString
containing the whole URL of the script executed in the
Worker
. It is a synonym for
URLUtilsReadOnly.href
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of 'WorkerLocation' in that specification. |
实时标准 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
WorkerLocation
|
Chrome 1 | Edge ≤79 | Firefox 3.5 | IE ? | Opera Yes | Safari ? | WebView Android Yes | Chrome Android Yes | Firefox Android 4 | Opera Android Yes | Safari iOS ? | Samsung Internet Android Yes |
完整支持
兼容性未知
Worker
,
WorkerNavigator
,和
WorkerGlobalScope
.