URL.密码

This translation is incomplete. Please help translate this article from English

{{ApiRef("URL API")}}

{{domxref(“ URL”)}}界面的password属性为{{domxref(“ USVString”)}}},其中包含在域名之前指定的密码。

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

{{AvailableInWorkers}}

Syntax

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

Value

A {{domxref("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"

Specifications

Specification Status Comment
{{SpecName('URL', '#dom-url-password', 'URL.password')}} {{Spec2('URL')}} Initial definition.

Browser compatibility

{{Compat("api.URL.password")}}

See also

  • The {{domxref("URL")}} interface it belongs to.