javascript password protect page with JavaScript Prompt - Web Development and Web Design Codes

Latest

Tuesday, May 1, 2018

javascript password protect page with JavaScript Prompt

JavaScript password protect page

JavaScript Prompt Examples
JavaScript Prompt Examples
Hi friends i hope you are doing well...today in this lesson we are going to learn how to password protect your website with JavaScript prompt..when a user visit a protected page of your website it asked username and password to access this page..if the user entered correct username and password in JavaScript prompt box user will get access the page..if entered false information he will redirect to a blank page..you can protect your personal page using JavaScript prompt login...follow the below JavaScript prompt examples  to create password protected web page in JavaScript..


JavaScript Prompt Examples:

create a simple login.html page and save the below codes then run it...
note: username: codenair and password: codenair
<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