Password protect web page using javascript
Password protect web page using javascript
Password protect web page using JavaScript
here is a simple code on how to password protect a web page using JavaScript. It is easy to enable password protected web pages using JavaScript but it is not secure at all as JavaScript is client side language and can be disabled at any time to gain access. I have also implemented a variable named count and if reaches 4 then there will no longer be any prompt and it goes back to the main page.
You can change these settings like password and max attempts by modifying these variables
//change to your password var password = "iamlost" //max attempts var maxattempt = 4
The complete code will look like the one below.
<script type="text/javascript"> function passWord() { var count = 1; var pass1 = prompt('Please Enter Your Password',' '); //change to your password var password = "iamlost" //max attempts var maxattempt = 4 while (count < 4) { if (!pass1) history.go(-1); if (pass1.toLowerCase() == password) { alert('You Got it Right!'); window.open('theotherpage.html'); break; } count+=1; var pass1 = prompt('Access Denied - Password Incorrect, Please Try Again.','Give Me The Password'); } if(count == maxattempt) { alert("Attempted 4 times") } } </SCRIPT> <CENTER> <FORM> <input type="button" value="Enter Protected Area" onClick="passWord()"> </FORM> </CENTER></strong>
All you have to do is save the above script to a HTML file. Run the script, Click on the button which says Enter Protected Area and enter the password “iamlost”, If you have entered the correct password you will be taken to the URL “theotherpage.html” otherwise it will show Access denied and a maximum of 4 prompts will be displayed.
Password protect web page using javascript,Incoming search terms:
- jquery password protect page (96)
- jquery password protected page (39)
- jquery password protect web page (17)
- jquery password protect a page (11)
- password protect a webpage no alert (1)
- password protect a website directory with jquery (1)
- password protect page with javascript tutorial (1)
- password protect using javascript (1)
- password protected directory jquery (1)
- simple password protected page jquery (1)
- using jquery submit password protected from (1)
- password protect a div (1)
- jquery pdo password protect website access script (1)
- arduino html password protection for protected area (1)
- jquery password page (1)
- how to make a html page password protected using jquery (1)
- how make protected page jawascript (1)
- crack online password javascript (1)
- arduino password protected div (1)
- arduino password protect webpage (1)
- web page protected using javascript (1)