CredentialsContainer - Web API 接口参考 编辑
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
Credential Management API 的 CredentialsContainer
接口提供了请求 credentials 和通知用户代理(当成功登陆或登出事件发生时)的方法。可通过 Navigator.credentials
获得该接口。
属性
None.
事件
None.
返回一个带有处理值 Credential
(若它能够使用提供的选项创建的话)的 Promise
,或返回 null
(若不能创建 Credential
)。在特殊情况下,返回的 Promise
对象可能 reject。
方法
CredentialsContainer.create()
- Returns a
Promise
that resolves with a newCredential
instance based on the provided options, ornull
of noCredential
object can be created. CredentialsContainer.get()
- Returns a
Promise
that resolves with theCredential
instance that matches the provided parameters. CredentialsContainer.preventSilentAccess()
- Sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty
Promise
. For example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. Earlier versions of the spec called this methodrequireUserMediation()
. See Browser compatibility for support details. CredentialsContainer.store()
- Stores a set of credentials for a user, inside a provided
Credential
instance and returns that instance in aPromise
.
示例
// TBD
Specifications
Specification | Status | Comment |
---|---|---|
Credential Management Level 1 | Working Draft | Initial definition. |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 51 | ? | ? | 未实现 | ? |
create() | 60 | ? | ? | 未实现 | ? |
requireUserMediation() renamed preventSilentAccess() | 60 | ? | ? | 未实现 | ? |
Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | 51 | 51 | ? | ? | ? | 未实现 | ? |
create() | 60 | 60 | ? | ? | ? | 未实现 | ? |
requireUserMediation() renamed preventSilentAccess() | 60 | 60 | ? | ? | ? | 未实现 | ? |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论