added unsupported browser warning

This commit is contained in:
Alex Booker 2015-08-15 10:15:19 +01:00
parent 793665eeb2
commit b46a16ff92

View File

@ -15,6 +15,9 @@
padding: 10px; padding: 10px;
margin-bottom: 20px; margin-bottom: 20px;
} }
.unsupported-browser-alert {
display: none;
}
</style> </style>
</head> </head>
<body> <body>
@ -28,6 +31,11 @@
<noscript> <noscript>
<div class="alert alert-danger"><span class="glyphicon glyphicon-warning-sign"></span> <strong>Hold on.</strong> It looks like you have disabled JavaScript. Unfortunately, this tool will not work until you enable it.</div> <div class="alert alert-danger"><span class="glyphicon glyphicon-warning-sign"></span> <strong>Hold on.</strong> It looks like you have disabled JavaScript. Unfortunately, this tool will not work until you enable it.</div>
</noscript> </noscript>
<div class="alert alert-danger unsupported-browser-alert" id="unsupported-browser-alert">
<p>
<span class="glyphicon glyphicon-warning-sign"></span> <strong>Hold on.</strong> It looks like you are using an <em>unsuported browser</em> (probably Internet Explorer...) Unfortunately, this tool will not work until you upgrade your browser. Sorry for any inconvenience caused.
</p>
</div>
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
<p>Use this online tool to generate a strong and random password. Password generation is done on the client-side meaning no one has access to the passwords you generate here, <em>period</em>.</p> <p>Use this online tool to generate a strong and random password. Password generation is done on the client-side meaning no one has access to the passwords you generate here, <em>period</em>.</p>
</div> </div>
@ -181,7 +189,13 @@
} }
}; };
function outputGeneratedPassword() { function outputGeneratedPassword() {
var password = passwordGenerator.generatePassword(getOptions()); var password;
try {
password = passwordGenerator.generatePassword(getOptions());
}
catch (error) {
return $("#unsupported-browser-alert").show();
}
if (password === '') { if (password === '') {
alert("Whops. You unselected all the options. I don't know what characters you want. Click on the button entitled \"Advanced Options\" and enable some options then try again. Nice one"); alert("Whops. You unselected all the options. I don't know what characters you want. Click on the button entitled \"Advanced Options\" and enable some options then try again. Nice one");
return; return;