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 HTMLAnchorElement and HTMLAreaElement implement it.
Note: This interface doesn't inherit any property.
HTMLHyperlinkElementUtils.hrefUSVString containing the whole URL.HTMLHyperlinkElementUtils.protocolUSVString containing the protocol scheme of the URL, including the final ':'.HTMLHyperlinkElementUtils.hostUSVString 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.hostnameUSVString containing the domain of the URL.HTMLHyperlinkElementUtils.portUSVString containing the port number of the URL.HTMLHyperlinkElementUtils.pathnameUSVString containing an initial '/' followed by the path of the URL.HTMLHyperlinkElementUtils.searchUSVString containing a '?' followed by the parameters of the URL.HTMLHyperlinkElementUtils.hashUSVString containing a '#' followed by the fragment identifier of the URL.HTMLHyperlinkElementUtils.usernameUSVString containing the username specified before the domain name.HTMLHyperlinkElementUtils.passwordUSVString containing the password specified before the domain name.HTMLHyperlinkElementUtils.origin Read only
USVString containing the origin of the URL (that is its scheme, its domain and its port).Note: This interface doesn't inherit any method.
HTMLHyperlinkElementUtils.toString()DOMString containing the whole URL. It is a synonym for HTMLHyperlinkElementUtils.href, though it can't be used to modify the value.| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of 'HTMLHyperlinkElementUtils' in that specification. | Living Standard | Initial definition |
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | (Yes) [1] | 22 (22) [3][4] | No support [2] | No support [2] | No support [2] |
username and password
| (Yes) | 26 (26) [3] | No support | ? | ? |
origin | (Yes) | 26 (26) [3] | ? | ? | ? |
| Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | 22.0 (22) [3][4] | No support [2] | No support [2] | No support [2] |
username and password
| (Yes) | (Yes) | 26.0 (26) [3] | No support | ? | ? |
origin | (Yes) | (Yes) | 26.0 (26) [3] | ? | ? | ? |
[1] Starting in Chrome 52, the members of this interface were moved to URL
[2] Though not grouped in a single abstract interface, these methods are directly available on the interfaces that implement it, if this interface is supported.
[3] This mixin was called URLUtils before Firefox 45, and was also implemented to other by other interfaces, like Location. From Firefox 45, the other interfaces implement their own version of the properties and methods they need.
[4] Firefox has a bug whereby single quotes contained in URLs are escaped when accessed via URL APIs (bug 1386683). This has been fixed as of Firefox 57.
HTMLAnchorElement, HTMLAreaElement
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils