Gid*_*abu 5 javascript webauthn
我正在使用新的PasswordCredential API 并创建了这段代码。它正在发挥作用。但对于某些用户来说,它会抛出此错误The user agent does not support public key credentials.
if (window.PasswordCredential) {
navigator.credentials.get({
password: true,
mediation: 'optional'
}).then(credential => {
if (credential) {
if (credential.type === 'password') {
// authenticate the user with obtained credentials
}
});
}
Run Code Online (Sandbox Code Playgroud)
尽管我没有使用该 API,但许多用户都会遇到该错误。那么,我应该像这样检查这两个条件吗:
if (window.PasswordCredential && typeof(PublicKeyCredential) != "undefined" ) {
如果是这样,我为什么要对两者都进行此检查?
| 归档时间: |
|
| 查看次数: |
3979 次 |
| 最近记录: |