How to password protect a web page?
For password protecting specific pages in your website, web server level permission settings usually provide the highest level of security. Web server settings are adjusted outside of the App, your web host will be able to help with setting up folder level protections.

On the other hand, if you're looking for a quick and a simple password widget, here is a JavaScript code segment shared with us from a fellow HTML Egg user.

Please keep in mind this JavaScript widget code is not encrypted, and the raw code is available in the page source. (Low level of security) Depending on your needs, you may wish to consider using server level permission settings for pages you really do not wish unauthorized users to access.

To implement, please paste code into the Custom Header Code section of your Page Preferences. (See attached image with notes for instructions on customizing the code for your specific page)

<SCRIPT>
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "mypassword") {
window.open('http://www.website.com/webpage.html');
break;
}
testV+=1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
</SCRIPT>
<CENTER>
<FORM>
<input type="button" value="Enter Protected Page" onClick="passWord()">
</FORM>
</CENTER>

Related Images


Image0