Web/API/URL/username

From Get docs
< Web/API‎ | URL


The username property of the URL interface is a USVString containing the username specified before the domain name.

Note: This feature is available in Web Workers.

Syntax

const usernameString = url.username
url.username = newUsername

Value

A USVString.

Examples

const url = new URL('https://anonymous:[email protected]/en-US/docs/Web/API/URL/username');
console.log(url.username) // Logs "anonymous"

Specifications

Specification Status Comment
URLThe definition of 'username' in that specification. Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
username Chrome

Full support 32

Edge

Full support 12

Firefox

Full support 26

IE

No support No

Opera

Full support Yes

Safari

Full support 10

WebView Android

Full support ≤37

Chrome Android

Full support 32

Firefox Android

Full support 26

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support 6.0

Legend

Full support  
Full support
No support  
No support


See also

  • The URL interface it belongs to.