Skip to content

Instantly share code, notes, and snippets.

@jayllellis
Last active August 29, 2015 14:28
Show Gist options
  • Save jayllellis/0e91bacd8a96bd2b8e7f to your computer and use it in GitHub Desktop.
Save jayllellis/0e91bacd8a96bd2b8e7f to your computer and use it in GitHub Desktop.
Simple prompt user for password before allowing access to page.
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Password Prompt</title>
<script type="text/javascript">
function checkpassword(){
var VIPpassword;
VIPpassword = prompt("Please enter the password", "");
if (VIPpassword != 'testpassword') {
alert("The password you entered is not correct. Please see the correct password on the page.");
window.location = "http://jasonellis.ca";
}
}
</script>
</head>
<body onload="javascript:checkpassword();">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment