The password property of the URL interface is a USVString containing the password specified before the domain name.
If it is set without first setting the username property, it silently fails.
Note: This feature is available in Web Workers.
Syntax
const passwordString = url.password url.password = newPassword
Value
A USVString.
Examples
const url = new URL('https://anonymous:[email protected]/en-US/docs/Web/API/URL/password');
console.log(url.password) // Logs "flabada"
Specifications
| Specification | Status | Comment |
| URLThe definition of 'URL.password' 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.
Update compatibility data on GitHub
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
password
|
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
URLinterface it belongs to.
URL.password by Mozilla Contributors is licensed under CC-BY-SA 2.5.