Facebook Twitter Reset

This Tutorial Has Been Viewed 4,004 Times.

Password protect pages using javascript

Hello guys here is a simple code on how to password protect a webpage usingĀ  javascript.This is not a good idea coz it is not at all secure.But simply just like that a webpage which is protected using simple javascript is fun. :)

<script type=“text/javascript”>
function passWord() {
var testV = 1;
var pass1 = prompt(‘Please Enter Your Password’,’ ‘);
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == “iamlost”) {
alert(‘You Got it Right!’);
window.open(‘theotherpage.html’);
break;
}
testV+=1;
var pass1 =
prompt(‘Access Denied – Password Incorrect, Please Try Again.’,'Give Me The Password’);
}
if (pass1.toLowerCase()!=”password” & testV ==3)
history.go(-1);
return ” “;
}
</SCRIPT>
<CENTER>
<FORM>
<input type=”button” value=”Enter Protected Area” onClick=”passWord()”>
</FORM>
</CENTER>

In the next version of this tutorial i can tell you guys how we can hide a div element and get the password from it do visit me often guys.

VN:F [1.9.13_1145]
Rating: 7.8/10 (4 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 2 votes)
Password protect pages using javascript, 7.8 out of 10 based on 4 ratings

Incoming search terms:

No comments yet.

Leave a Comment

Spam protection by WP Captcha-Free

Affordable Seo PackagesSeo BlogEdu Backlinks
More in PHP, scripts (108 of 149 articles)