Use this script to protect online files. Users cannot cancel out of it. It can also be used with your browser’s home page to control Internet access on your own computer.
Copy the coding into the HEAD of your HTML document:
<script type=”text/javascript”>
<!– Begin
/* This script and many more are available free online at
The JavaScript Source :: http://javascriptsource.com
Created by: Javascript Newbie :: http://expage.com/javascriptnewbie
*/
var password;
var pass1 = “password”; // place password here
password=prompt(“Please enter your password:”,””);
if (password==pass1) {
window.location= “test2.html”; // file to open if password is correct
} else {
window.location= “test.html”; // file to load if password is incorrect
}
// End –>
</script>
<p><center>
<font face=”arial, helvetica” size”-2″>Free JavaScripts provided<br>
by <a href=”https://javascriptsource.com”>The JavaScript Source</a></font>
</center><p>