The HTMLHyperlinkElementUtils.username property is a USVString containing the username specified before the domain name.


string = object.username;
object.username = string;


// Let's <a id="myAnchor" href=""> be in the document
var anchor = document.getElementByID("myAnchor");
var result = anchor.username; // Returns:'anonymous'


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

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes1 ?262 No No No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes1 Yes1 ?262 No No ?

1. Starting in Chrome 52, this property was moved to URL

2. From Firefox 26 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

Contributors to this page: fscholz, jpmedley, teoli, chrisdavidmills, Kartik_Chadha
Last updated by: fscholz,