I am working with Javascript. I was using an alert to get a password from a user. However, as you may know, the alert does not mask the password from other "shoulder surfing". In an attempt to fix this I created a page that only allows a user to input their password that is opened from the parent javascript page. The issue is that the javascript will not wait for the user to input their password before executing more javascript instructions. My question, is how can I make my javascript wait to receive the information form the user before executing the next instruction?
The below parent page is a sample of what I am working with. Since I read online that you could not mask the window.prompt input, decided to try and open a new window and have the user input it into an html form. This is the bare minimum code required from the parent (the real parent page is much longer with nothing relevant to the question). Parent Page:
<html>
<head>
<script language="javascript">
function start()
{
document.write("here");
var w = window.open('password.html','newWindow','width=550,height=170,left=150,top=200,toolbar=no,resizable=false');
var password = "holder value";
document.write(password);
}
</script>
<title>
Parent Window
</title>
</head>
<body onload="start()">
</body>
</html>
Child page:
<html>
<head>
<title>This is for the user to input their password</title>
<script language="javascript">
function Parent()
{
console.log("working");
//opener.document.form.parent_name.value = document.frm.child_name.value;
// opener.document.form.parent_name.value = document.Input.pwd.value;
opener.document.password= document.Input.pwd.value;
self.close();
}
</script>
</head>
<body>
<form name="Input" method="post" action="">
<input type="password" name="pwd">
<input type="button" value="Submit" onClick="Parent()">
</form>
</body>
</html>