URL.密码

 URL接口的password属性为USVString,其中包含在域名之前指定的密码。

如果在未设置username属性的情况下进行调用,默认失败。

Note: 此特性在 Web Worker 中可用。

语法

string = object.password;
object.password = string;

A USVString.

Examples

var url = new URL('https://anonymous:flabada@developer.mozilla.org/en-US/docs/Web/API/URL/password');
var result = url.password; // Returns:"flabada"

规范

Specification Status Comment
URL
URL.password
Living Standard Initial definition.

浏览器兼容

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
passwordChrome Full support 32Edge Full support 12Firefox Full support 26IE ? Opera Full support YesSafari Full support 10WebView Android Full support ≤37Chrome Android Full support 32Firefox Android Full support 26Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 6.0

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

参见

  • The URL interface it belongs to.