HTMLHyperlinkElementUtils

Experimental

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 (en-US) and HTMLAreaElement (en-US). These utilities allow to deal with common features like URLs.

There are no objects of this type, but several objects HTMLAnchorElement (en-US) and HTMLAreaElement (en-US) implement it.

Properties

Note: This interface doesn't inherit any property.

HTMLHyperlinkElementUtils.href
This is a USVString containing the whole URL.
HTMLHyperlinkElementUtils.protocol (en-US)
This is a USVString containing the protocol scheme of the URL, including the final ':'.
HTMLHyperlinkElementUtils.host (en-US)
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 (en-US)
This is a USVString containing the domain of the URL.
HTMLHyperlinkElementUtils.port (en-US)
This is a USVString containing the port number of the URL.
HTMLHyperlinkElementUtils.pathname (en-US)
This is a USVString containing an initial '/' followed by the path of the URL.
HTMLHyperlinkElementUtils.search (en-US)
This is a USVString containing a '?' followed by the parameters of the URL.
HTMLHyperlinkElementUtils.hash (en-US)
This is a USVString containing a '#' followed by the fragment identifier of the URL.
HTMLHyperlinkElementUtils.username (en-US)
This is a USVString containing the username specified before the domain name.
HTMLHyperlinkElementUtils.password (en-US)
This is a USVString containing the password specified before the domain name.
HTMLHyperlinkElementUtils.origin (en-US) 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() (en-US)
This returns a DOMString containing the whole URL. It is a synonym for HTMLHyperlinkElementUtils.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

No compatibility data found for api.HTMLHyperlinkElementUtils.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.

See also