Skip to content

Commit 5ad05ae

Browse files
committed
CREDENTIAL: Add a warning to the demo page.
1 parent 33d30f5 commit 5ad05ae

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

demos/credential-management/script.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ if (navigator.credentials) {
1010
password: true,
1111
suppressUI: true
1212
}).then(processResponse);
13+
} else {
14+
var section = document.createElement('section');
15+
section.innerHTML = "<p><code>navigator.credentials</code> is not available! Have you enabled the feature in your browser? (Visit <code>chrome://flags/#enable-credential-manager-api</code> in Chrome, for example.)</p>";
16+
section.classList.toggle('warning');
17+
document.body.appendChild(section);
1318
}
1419

1520
function toggleState() {

demos/credential-management/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
body {
22
margin: 0 auto;
3-
width: 500px;
3+
width: 500px;
44
}
55
header {
66
background: #EEE;
@@ -27,7 +27,7 @@ section.signedout, section.signedin {
2727
display: none;
2828
}
2929

30-
.signedout section.signedout {
30+
.signedout section.signedout, .warning {
3131
border: 1px solid #999;
3232
background: #FF6666;
3333
margin: 0.25em 0;

0 commit comments

Comments
 (0)