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:flabada@developer.mozilla.org/docs/Web/API/URL/username'); console.log(url.username) // Logs "anonymous"
Specifications
Specification | Status | Comment |
---|---|---|
URL The definition of 'username' in that specification. |
Living Standard | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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.