Forum Moderators: open
for example i cannot use a script that will leave the following trail in the history login.cgi?username=test&password=pass123 so the only way round is to post the data with hidden fields. The script i have does exactly that. However, the only problem is that when it pops up, using java the html file keeps the username and password as hidden fields, but requires that i click on a button to login. I wish to get rid of that and i want it to just automatically login (maybe using onload="document.Login.submit();" )
I would be very greatful if someone can help me on this.
Below is my code:
in the inital login page i have the following script between the <head> tags:
<script language="javascript" type="text/javascript">
<!--
function newWin(){
confirmWin = window.open('page02.html','confWin','width=640,height=480,scrollbars=yes,left=380,top=0')
if(confirmWin.opener==null){
confirmWin.opener = self;
}
}
//-->
</script>
and after the <body> tag i have the following:
<form name="loginfrm" method="post" onSubmit="newWin()">
<p>
Account ID
<br />
<input type="text" name="accountnumber" size="26" />
<br />
Password
<br />
<input type="password" name="password" size="26" />
<br />
<input type="button" onclick="newWin()" value="Confirm Details" />
</p>
</form>
----------------------------
and on page02.html i have the following code between the <head> tag
<SCRIPT language="javascript" type="text/javascript">
<!--
var ttestFrm = opener.document.loginfrm;
var accid = opener.document.loginfrm.accountnumber;
var pwd = opener.document.loginfrm.password ;
function setData(){
{
document.write("<form method=POST action=login.cgi name=login>");
document.write("<input type=hidden name=username size=15 value=" + accid.value + ">");
document.write("<input type=hidden name=password size=15 value=" + pwd.value + ">");
document.write("<input type=submit name=submit value='Click Here to Login'>");
document.write("<\/FORM>");
}
}
//-->
</SCRIPT>
and i have the following code after the <body> tag:
<SCRIPT language="javascript" type="text/javascript">
<!--
setData()
//-->
</SCRIPT>
Many thanks for your help
[edited by: jatar_k at 5:51 pm (utc) on Mar. 10, 2003]
[edit reason] no urls please [/edit]
Why not just POST the data from your inital login page form? I think that it would only leave a trail,
login.cgi?username=test&password=pass123
if the form's Action was GET rather than POST.
Anyhow's to help with with your script, add this line
document.login.submit(); eg
<SCRIPT language="javascript" type="text/javascript">
<!--
setData();
document.login.submit();
//-->
</SCRIPT>
to page02.html