This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The credentials
property of the Navigator
interface returns the CredentialsContainer
interface, which exposes methods to request-credentials. The CredentialsContainer
interface also notifies the user agent when an interesting event occurs, such as a successful sign-in or sign-out. This interface can be used for feature detection.
var credentialsContainer = navigator.credentials
The CredentialsContainer
interface.
if ('credentials' in navigator) { navigator.credentials.get({password: true}) .then(function(creds) { //Do something with the credentials. }); } else { //Handle sign-in the way you did before. };
Specification | Status | Comment |
---|---|---|
Credential Management Level 1 | Working Draft | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 51 | ? | ? | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 51 | 51 | ? | ? | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/navigator/credentials