这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

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.

特性

注意: 此接口未继承任何特性。

HTMLHyperlinkElementUtils.href
This a stringifier property that returns a USVString containing the whole URL, and allows the href to be updated.
HTMLHyperlinkElementUtils.protocol
这是 USVString 包含 URL 的协议方案,包括最终的 ':' .
HTMLHyperlinkElementUtils.host
这是 USVString 包含主机,即 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 ':' ,和 port of the URL.
HTMLHyperlinkElementUtils.hostname
这是 USVString 包含 URL 的域。
HTMLHyperlinkElementUtils.port
这是 USVString 包含 URL 的端口号。
HTMLHyperlinkElementUtils.pathname
这是 USVString 包含初始 '/' followed by the path of the URL.
HTMLHyperlinkElementUtils.search
这是 USVString 包含 '?' followed by the parameters of the URL.
HTMLHyperlinkElementUtils.hash
这是 USVString 包含 '#' followed by the fragment identifier of the URL.
HTMLHyperlinkElementUtils.username
这是 USVString containing the username specified before the domain name.
HTMLHyperlinkElementUtils.password
这是 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 for HTMLHyperlinkElementUtils.href , though it can't be used to modify the value.

规范

规范 状态 注释
HTML 实时标准
The definition of 'HTMLHyperlinkElementUtils' in that specification.
实时标准 初始定义

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
HTMLHyperlinkElementUtils Chrome Yes
Yes
Starting in Chrome 52, the members of this interface were moved to URL
Edge 12 Firefox 22
22
This mixin was called URLUtils before Firefox 45, and was also implemented to other by other interfaces, like 定位 . From Firefox 45, the other interfaces implement their own version of the properties and methods they need.
Firefox was a bug whereby single contained in URLs are escaped when accessed via URL APIs ( bug 1386683 ). This has been as of Firefox 57.
IE 5 Opera Yes
Yes
Starting in Opera 39, the members of this interface were moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, the members of this interface were moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, the members of this interface were moved to URL
Firefox Android 22
22
This mixin was called URLUtils before Firefox 45, and was also implemented to other by other interfaces, like 定位 . From Firefox 45, the other interfaces implement their own version of the properties and methods they need.
Firefox was a bug whereby single contained in URLs are escaped when accessed via URL APIs ( bug 1386683 ). This has been as of Firefox 57.
Opera Android Yes
Yes
Starting in Opera 39, the members of this interface were moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, the members of this interface were moved to URL
hash Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 12 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface. Also, from Firefox 29 to Firefox 40, the returned value was incorrectly percent-decoded.
IE 5 Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface. Also, from Firefox 29 to Firefox 40, the returned value was incorrectly percent-decoded.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
host Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 12 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE 5
5
In Internet Explorer 9, the host of an <a> always include the port (e.g. developer.mozilla.org:443 ), even if there is no explicit port in the href attribute value.
Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
hostname Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 12 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE 5 Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
href Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 12 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE 5 Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
origin Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 17 Firefox 26
26
From Firefox 26 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Before Firefox 49, results for URL using the blob scheme incorrectly returned null .
IE No Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 26
26
From Firefox 26 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Before Firefox 49, results for URL using the blob scheme incorrectly returned null .
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
password Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 79 Firefox 26
26
From Firefox 26 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE No Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 26
26
From Firefox 26 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
pathname Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 12 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Before Firefox 53, the pathname and search HTMLHyperlinkElementUtils properties returned the wrong parts of the URL. For example, for a URL of http://z.com/x?a=true&b=false , pathname would return '/x?a=true&b=false' and search would return '', rather than '/x' and '?a=true&b=false' respectively. This has now been fixed.
IE 5 Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Before Firefox 53, the pathname and search HTMLHyperlinkElementUtils properties returned the wrong parts of the URL. For example, for a URL of http://z.com/x?a=true&b=false , pathname would return '/x?a=true&b=false' and search would return '', rather than '/x' and '?a=true&b=false' respectively. This has now been fixed.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
port Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 12 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE 5 Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
协议 Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 12 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE 5 Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
search Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 12 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Before Firefox 53, the pathname and search HTMLHyperlinkElementUtils properties returned the wrong parts of the URL. For example, for a URL of http://z.com/x?a=true&b=false , pathname would return '/x?a=true&b=false' and search would return '', rather than '/x' and '?a=true&b=false' respectively. This has now been fixed.
IE 5 Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Before Firefox 53, the pathname and search HTMLHyperlinkElementUtils properties returned the wrong parts of the URL. For example, for a URL of http://z.com/x?a=true&b=false , pathname would return '/x?a=true&b=false' and search would return '', rather than '/x' and '?a=true&b=false' respectively. This has now been fixed.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL
toString Chrome 52 Edge ≤18 Firefox 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE No Opera Yes Safari Yes WebView Android 52 Chrome Android 52 Firefox Android 22
22
From Firefox 22 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes Safari iOS Yes Samsung Internet Android 6.0
username Chrome Yes
Yes
Starting in Chrome 52, this property was moved to URL
Edge 79 Firefox 26
26
From Firefox 26 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
IE No Opera Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari Yes WebView Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Chrome Android Yes
Yes
Starting in Chrome 52, this property was moved to URL
Firefox Android 26
26
From Firefox 26 to Firefox 44, this property was on the URLUtils mixin. It has been moved either on the HTMLHyperlinkElementUtils mixin, or directly on the interface.
Opera Android Yes
Yes
Starting in Opera 39, this property was moved to URL
Safari iOS Yes Samsung Internet Android Yes
Yes
Starting in Samsung Internet 6.0, this property was moved to URL

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

另请参阅

元数据

  • 最后修改:
  1. URL API
  2. HTMLHyperlinkElementUtils
  3. 特性
    1. hash
    2. host
    3. hostname
    4. href
    5. origin
    6. password
    7. pathname
    8. port
    9. 协议
    10. search
    11. username
  4. 方法
    1. toString()
  5. 实现通过:
    1. HTMLAnchorElement
    2. HTMLAreaElement
  6. Related pages for URL API
    1. URL
    2. URLSearchParams
    3. URLUtilsReadOnly

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1