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


string = object.toString();


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


Specification Status Comment
HTML Living Standard
The definition of 'HTMLHyperlinkElementUtils.toString()' in that specification.
Living Standard Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support52 Yes221 No No No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support5252 Yes221 No No ?

1. 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.

See also

Document Tags and Contributors

Last updated by: fscholz,