diff --git a/js/passwordGenerator.js b/js/passwordGenerator.js index 6615d06f..13e7d41b 100644 --- a/js/passwordGenerator.js +++ b/js/passwordGenerator.js @@ -1,5 +1,8 @@ var passwordGenerator = (function() { var generateRandomNum = function (max) { + if (!window.crypto || !window.crypto.getRandomValues) { + throw new Error('Unsupported browser.'); + } var array = new Uint8Array(1); window.crypto.getRandomValues(array); var range = max + 1;