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.
Properties
Note: 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
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
DOMString
containing the whole URL. It is a synonym forHTMLHyperlinkElementUtils.href
, though it can't be used to modify the value.
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLHyperlinkElementUtils' in that specification. |
Living Standard | Initial definition |
Browser compatibility
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.
Update compatibility data on GitHub
Desktop | Mobile | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Basic support | Chrome
Full support
Yes
| Edge ? | Firefox
Full support
22
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile ? | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
hash | Chrome
Full support
Yes
| Edge Full support Yes | Firefox
Full support
22
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile Full support Yes | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
host | Chrome
Full support
Yes
| Edge Full support Yes | Firefox
Full support
22
| IE
No support
No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile Full support Yes | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
hostname | Chrome
Full support
Yes
| Edge Full support Yes | Firefox
Full support
22
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile Full support Yes | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
href | Chrome
Full support
Yes
| Edge Full support Yes | Firefox
Full support
22
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile Full support Yes | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
origin | Chrome
Full support
Yes
| Edge Full support Yes | Firefox
Full support
26
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile Full support Yes | Firefox Android
Full support
26
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
password | Chrome
Full support
Yes
| Edge ? | Firefox
Full support
26
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile ? | Firefox Android
Full support
26
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
pathname | Chrome
Full support
Yes
| Edge No support No | Firefox
Full support
22
| IE
Partial support
Partial
| Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile No support No | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
port | Chrome
Full support
Yes
| Edge No support No | Firefox
Full support
22
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile No support No | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
protocol | Chrome
Full support
Yes
| Edge No support No | Firefox
Full support
22
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile No support No | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
search | Chrome
Full support
Yes
| Edge Full support Yes | Firefox
Full support
22
| IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile Full support Yes | Firefox Android
Full support
22
| Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
toString | Chrome Full support 52 | Edge Full support Yes | Firefox
Full support
22
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android Full support 52 | Chrome Android Full support 52 | Edge Mobile Full support Yes | Firefox Android
Full support
22
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
username | Chrome
Full support
Yes
| Edge ? | Firefox
Full support
26
| IE No support No | Opera No support No | Safari Full support Yes | WebView Android
Full support
Yes
| Chrome Android
Full support
Yes
| Edge Mobile ? | Firefox Android
Full support
26
| Opera Android No support No | Safari iOS Full support Yes | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
- See implementation notes.
- See implementation notes.
See also
- Interfaces implementing this one:
HTMLAnchorElement
,HTMLAreaElement
Document Tags and Contributors
Tags:
Contributors to this page:
connorshea,
fscholz,
myf,
RayannTedds,
ricea,
chrisdavidmills,
jpmedley,
teoli,
cvrebert,
baku,
Bzbarsky,
Annevk
Last updated by:
connorshea,