HTML and Javascript

How Do I Password Protect A Page?

--Here's a quick script that you can cut and paste in between your head tags. <head> code here </head> of your webpage you wish to protect from unauthorized users. The red color text is the any password you wish to use. And the blue colored URL (domian address) is the page you wish to protect.

 

<HEAD>
<SCRIPT language="JavaScript">
<!--hide

var password;

var pass1="secret";

password=prompt('Please enter your password to view this page!',' ');

if (password=pass1)
alert('Woot!!! Password Correct Click OK to enter!');
else
{
window.location="http://www.wootsite.com/Test/protectedpage.html";
}

//-->
</SCRIPT>
</HEAD>

 

TEST SCRIPT

Password is secret