HTMLHyperlinkElementUtils.toString()

The HTMLHyperlinkElementUtils.toString() stringifier method returns a USVString containing the whole URL. It is a read-only version of HTMLHyperlinkElementUtils.href.

Syntax

string = object.toString();

Examples

// Let's imagine an <a id="myAnchor" href="https://developer.mozilla.org/docs/HTMLHyperlinkElementUtils/toString"> element is in the document
var anchor = document.getElementById("myAnchor");
var result = anchor.toString(); // Returns: 'https://developer.mozilla.org/docs/HTMLHyperlinkElementUtils/toString'

Specifications

Specification Status Comment
HTML Living Standard Living Standard

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
toStringChrome Full support 52Edge Full support ≤18Firefox Full support 22
Notes
Full support 22
Notes
Notes 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 support NoOpera Full support YesSafari Full support YesWebView Android Full support 52Chrome Android Full support 52Firefox Android Full support 22
Notes
Full support 22
Notes
Notes 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 Full support YesSafari iOS Full support YesSamsung Internet Android Full support 6.0

Legend

Full support
Full support
No support
No support
See implementation notes.
See implementation notes.

See also