WorkerLocation - Web APIs 编辑

The 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.

Properties

The WorkerLocation interface doesn't inherit any property, but implements properties defined in the URLUtilsReadOnly interface.

URLUtilsReadOnly.href Read only
Is a stringifier that returns a DOMString containing the whole URL of the script executed in the Worker.
URLUtilsReadOnly.protocol Read only
Is a DOMString containing the protocol scheme of the URL of the script executed in the Worker, including the final ':'.
URLUtilsReadOnly.host Read only
Is a DOMString containing the host, that is the hostname, a ':', and the port of the URL of the script executed in the Worker.
URLUtilsReadOnly.hostname Read only
Is a DOMString containing the domain of the URL of the script executed in the Worker.
URLUtilsReadOnly.origin Read only
Returns a DOMString containing the canonical form of the origin of the specific location.
URLUtilsReadOnly.port Read only
Is a DOMString containing the port number of the URL of the script executed in the Worker.
URLUtilsReadOnly.pathname Read only
Is a USVString containing an initial '/' followed by the path of the URL (not including the query string or fragment) of the script executed in the Worker.
URLUtilsReadOnly.search Read only
Is a DOMString containing a '?' followed by the parameters of the URL of the script executed in the Worker.
URLUtilsReadOnly.hash Read only
Is a DOMString containing a '#' followed by the fragment identifier of the URL of the script executed in the Worker.

Methods

The WorkerLocation interface doesn't inherit any method, but implements methods defined in the URLUtilsReadOnly interface.

URLUtilsReadOnly.toString()
Returns a DOMString containing the whole URL of the script executed in the Worker. It is a synonym for URLUtilsReadOnly.href.

Specifications

SpecificationStatusComment
HTML Living Standard
The definition of 'WorkerLocation' in that specification.
Living Standard

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:112 次

字数:6222

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文