URL:password 属性

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

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

备注: 此特性在 Web Worker 中可用。

语法

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

Examples

js
var url = new URL(
  "https://anonymous:flabada@developer.mozilla.org/zh-CN/docs/Web/API/URL/password",
);
var result = url.password; // Returns:"flabada"

规范

Specification
URL Standard
# dom-url-password

浏览器兼容性

BCD tables only load in the browser

参见

  • The URL interface it belongs to.