Skip to content

Commit

Permalink
Made web client also warn if a browser without WebCrypto support is used
Browse files Browse the repository at this point in the history
  • Loading branch information
palant committed Feb 2, 2018
1 parent 2529b00 commit 191a84a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
15 changes: 15 additions & 0 deletions web/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
* http://mozilla.org/MPL/2.0/.
*/

body
{
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 24px;
background-color: #fff;
color: #000;
}

#background,
#panel,
#allpasswords
Expand Down Expand Up @@ -32,3 +40,10 @@
width: 620px;
left: calc((100% - 620px) / 2);
}

.warning
{
background-color: #faa;
border-radius: 5px;
padding: 5px;
}
12 changes: 11 additions & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
<link rel="stylesheet" href="index.css">
</head>
<body>
<noscript>Please enable JavaScript for this application to work.</noscript>
<noscript>
<div class="warning">
Please enable JavaScript for this application to work.
</div>
</noscript>

<div id="no-webcrypto" class="warning" hidden>
Your browser lacks the required functionality for this application.
At least Mozilla Firefox 35, Google Chrome 37, Opera 24 or Microsoft
Edge 12 is required.
</div>
</body>
</html>
6 changes: 6 additions & 0 deletions web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ function createFrame(id, src, listener)

window.addEventListener("load", function()
{
if (!crypto.subtle || typeof crypto.subtle.encrypt != "function")
{
document.getElementById("no-webcrypto").hidden = false;
return;
}

createFrame("background", "background/background.html", () =>
{
createFrame("panel", "panel/panel.html", event =>
Expand Down

0 comments on commit 191a84a

Please sign in to comment.