URLUtils - Web API 接口参考 编辑
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
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 HTMLAnchorElement
and HTMLAreaElement
implement it.
属性
注意:This interface doesn't inherit any property.
HTMLHyperlinkElementUtils.href
- This is a
USVString
containing the whole URL. 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
- This is a
USVString
containing an initial'/'
followed by the path of the URL. 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
只读- This returns a
USVString
containing the origin of the URL (that is its scheme, its domain and its port).
方法
注意:This interface doesn't inherit any method.
HTMLHyperlinkElementUtils.toString()
- This returns a
USVString
containing the whole URL. It is a synonym forHTMLHyperlinkElementUtils.href
, though it can't be used to modify the value.
规范
规范 | 状态 | 备注 |
---|---|---|
HTML Living Standard HTMLHyperlinkElementUtils | Living Standard | Initial definition |
浏览器兼容性
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.参见
- Interfaces implementing this one:
HTMLAnchorElement
,HTMLAreaElement
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论