This option will reset the home page of this site. Restoring any closed widgets or categories.

Reset

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.5.7_846]
Rating: 7.8/10 (4 votes cast)
VN:F [1.5.7_846]
Rating: +1 (from 1 vote)

Related posts:

  1. Get browser version and details using javascript
  2. Check password strength using javascript
  3. DOM elements dynamically using our JAVASCRIPT
  4. Words Validation with Javascript
  5. WordPress Vulnerability
  6. Pass PHP Value To Javascript
  7. Simple message slideshow news ticker using javascript

Leave a Reply

Comments (required)

Spam Protected