HTMLHyperlinkElementUtils - Web APIs 编辑

Experimental

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The HTMLHyperlinkElementUtils mixin defines utility methods and properties to work with HTMLAnchorElement and HTMLAreaElement. These utilities allow to deal with common features like URLs.

There are no objects of this type, but several objects such as HTMLAnchorElement and HTMLAreaElement implement it.

Properties

Note: This interface doesn't inherit any property.

HTMLHyperlinkElementUtils.href
This a stringifier property that returns a USVString containing the whole URL, and allows the href to be updated.
HTMLHyperlinkElementUtils.protocol
This is a USVString containing the protocol scheme of the URL, including the final ':'.
HTMLHyperlinkElementUtils.host
This is a USVString containing the host, that is the hostname, and then, if the port of the URL is not empty (which can happen because it was not specified or because it was specified to be the default port of the URL's scheme), a ':', and the port of the URL.
HTMLHyperlinkElementUtils.hostname
This is a USVString containing the domain of the URL.
HTMLHyperlinkElementUtils.port
This is a USVString containing the port number of the URL.
HTMLHyperlinkElementUtils.pathname
Is a USVString containing an initial '/' followed by the path of the URL, not including the query string or fragment.
HTMLHyperlinkElementUtils.search
This is a USVString containing a '?' followed by the parameters of the URL.
HTMLHyperlinkElementUtils.hash
This is a USVString containing a '#' followed by the fragment identifier of the URL.
HTMLHyperlinkElementUtils.username
This is a USVString containing the username specified before the domain name.
HTMLHyperlinkElementUtils.password
This is a USVString containing the password specified before the domain name.
HTMLHyperlinkElementUtils.origin Read only
This returns a USVString containing the origin of the URL (that is its scheme, its domain and its port).

Methods

Note: This interface doesn't inherit any method.

HTMLHyperlinkElementUtils.toString()
This returns a USVString containing the whole URL. It is a synonym for HTMLHyperlinkElementUtils.href, though it can't be used to modify the value.

Specifications

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

Browser compatibility

BCD tables only load in the browser

See also

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

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

发布评论

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

词条统计

浏览:140 次

字数:6314

最后编辑:8 年前

编辑次数:0 次

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