JavaScript password protect page
![]() |
JavaScript Prompt Examples |
JavaScript Prompt Examples:
create a simple login.html page and save the below codes then run it...note: username: codenair and password: codenair
1 2 3 4 5 6 7 8 9 10 11 12 | <script language= "JavaScript" > var username = prompt( "Enter Your Username: codenair" , "" ) var password = prompt( "Enter Your Password: codenair " , "" ) if (username != "codenair" || password != "codenair" ) //You can Send user to Your Desired Location {window.location.href= "about:blank" ; } </script> <html> <title>Password Protected Website with JavaScript Prompt</title> <h1>This is Hidden Content...of JavaScript Password Protected Website</h1> </html> |
That's it Friends how to username and password protected page in JavaScript.
if you like this post please share ..Thank you for Visiting...
No comments:
Post a Comment
Thank You for Your Comment
Note: Only a member of this blog may post a comment.