Thursday, 27 March 2014

Password Protected Webpage Using Javascript

Password Protected Webpage Using Javascript

The following is a nasty trick to create password Protected pages and redirect to the central page if the password is correct otherwise redirect to a error page.. 


<html>
<head>
<script type="text/javascript">
var password = "please";
var x = prompt("Enter in the password "," ");
if (x.toLowerCase() == password) {
  alert("Come right in \n \n You've entered in the right password");
  window.location = "index.htm";
}
else {
  window.location = "bad.htm";
}
</script>
<title></title>
</head>
<body>
</body>
</html>

No comments:

Post a comment

Thank You for Your Comments. We will get back to you soon.

back to top