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 |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes
|
? | 22
|
No | No | No |
hash
|
Yes
|
Yes | 22
|
No | No | No |
host
|
Yes
|
Yes | 22
|
No
|
No | No |
hostname
|
Yes
|
Yes | 22
|
No | No | No |
href
|
Yes
|
Yes | 22
|
No | No | No |
origin
|
Yes
|
Yes | 26
|
No | No | No |
password
|
Yes
|
? | 26
|
No | No | No |
pathname
|
Yes
|
No | 22
|
No | No | No |
port
|
Yes
|
No | 22
|
No | No | No |
protocol
|
Yes
|
No | 22
|
No | No | No |
search
|
Yes
|
Yes | 22
|
Yes | Yes | Yes |
toString
|
52 | Yes | 22
|
No | No | No |
username
|
Yes
|
? | 26
|
No | No | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes
|
Yes
|
? | 22
|
No | No | ? |
hash
|
Yes
|
Yes
|
Yes | 22
|
No | No | ? |
host
|
Yes
|
Yes
|
Yes | 22
|
No | No | ? |
hostname
|
Yes
|
Yes
|
Yes | 22
|
No | No | ? |
href
|
Yes
|
Yes
|
Yes | 22
|
No | No | ? |
origin
|
Yes
|
Yes
|
Yes | 26
|
No | No | ? |
password
|
Yes
|
Yes
|
? | 26
|
No | No | ? |
pathname
|
Yes
|
Yes
|
No | 22
|
No | No | ? |
port
|
Yes
|
Yes
|
No | 22
|
No | No | ? |
protocol
|
Yes
|
Yes
|
No | 22
|
No | No | ? |
search
|
Yes
|
Yes
|
Yes | 22
|
Yes | Yes | ? |
toString
|
52 | 52 | Yes | 22
|
No | No | ? |
username
|
Yes
|
Yes
|
? | 26
|
No | No | ? |
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