这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
The interface of the
证书管理 API
provides information about a username/password pair. In supporting browsers an instance of this class may be passed in the
credential
成员对于
init
object for global
fetch
.
注意:
This interface is restricted to top-level contexts and cannot be used from an
<iframe>
.
PasswordCredential()
安全上下文
PasswordCredential
对象。
Inherits properties from its ancestor,
Credential
.
PasswordCredential.additionalData
安全上下文
FormData
instance, a
URLSearchParams
instance, or null. The data in the objects will be added to the
request
body and sent to the remote endpoint with the credentials.
PasswordCredential.iconURL
只读
安全上下文
USVString
containing a URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
PasswordCredential.idName
安全上下文
USVString
containing the name that will be used for the ID field when submitting the current object to a remote endpoint via
fetch
. This property defaults to 'username', but may be overridden to match whatever the backend service expects.
PasswordCredential.name
只读
安全上下文
USVString
containing a human-readable public name for display in a credential chooser.
PasswordCredential.password
只读
安全上下文
USVString
containing the password of the credential.
PasswordCredential.passwordName
安全上下文
USVString
representing the name that will be used for the password field when submitting the current object to a remote endpoint via
fetch
. This property defaults to 'password', but may be overridden to match whatever the backend service expects.
None.
None.
var cred = new PasswordCredential({
id: id,
password: password,
name: name,
iconURL: iconUrl
});
navigator.credentials.store(cred)
.then(function() {
// Do something else.
});
| 规范 | 状态 | 注释 |
|---|---|---|
| Credential Management Level 1 | 工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
PasswordCredential
|
Chrome 51 | Edge ≤79 | Firefox ? | IE ? | Opera Yes | Safari ? | WebView Android 51 | Chrome Android 51 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 5.0 |
PasswordCredential()
构造函数
非标
|
Chrome 51 | Edge ≤79 | Firefox ? | IE ? | Opera ? | Safari ? | WebView Android 51 | Chrome Android 51 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 5.0 |
additionalData
弃用
|
Chrome 51 | Edge ≤79 | Firefox ? | IE ? | Opera ? | Safari ? | WebView Android 51 | Chrome Android 51 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 5.0 |
iconURL
|
Chrome 52 | Edge ≤79 | Firefox ? | IE ? | Opera Yes | Safari ? | WebView Android 52 | Chrome Android 52 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 6.0 |
idName
弃用
|
Chrome 51 | Edge ≤79 | Firefox ? | IE ? | Opera ? | Safari ? | WebView Android 51 | Chrome Android 51 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 5.0 |
名称
|
Chrome 52 | Edge ≤79 | Firefox ? | IE ? | Opera Yes | Safari ? | WebView Android 52 | Chrome Android 52 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 6.0 |
password
|
Chrome 60 | Edge ≤79 | Firefox ? | IE ? | Opera Yes | Safari ? | WebView Android 60 | Chrome Android 60 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 8.0 |
passwordName
弃用
|
Chrome 51 | Edge ≤79 | Firefox ? | IE ? | Opera ? | Safari ? | WebView Android 51 | Chrome Android 51 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 5.0 |
完整支持
兼容性未知
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
PasswordCredential