pari
07-14-2004, 10:18 PM
Hi all,
I'm trying to implement a user authentication for a python s/w by use of javascript. When user clicks on a link(python cgi), a window pops-up asking for username and calls 2 diff cgi/py files to validate & log the user details.
What I need to do is after it succeeds, is to pass a variable(success/failure) back to parent at the same time closing pop-up so parent can take action depending on variable value.
the pop-up works, but passing variable by opener.retVal doesn't.
in parent:-
var retVal = 0
var handle= ''
function popup() {
handle = window.open("url", "name", "attributes")
if (handle.opener == null)
handle.opener = self
if (handle.closed)
window.alert(retVal)
}
<a href="url" onClick="popup()">Click here</a>
in child:-
function passval() {
opener.retVal = 1
}
<body onLoad="passval();self.close();">
The problem is as soon as popup window opens, the handle.closed statement is executed & fails because child is still open. How can I avoid this? How will it wait till child is closed?
I have been looking at FAQ's, & sites since morning but no answer. Sorry if my question seems too simple, but I'm hoping someone will reply. Thanks in advance.
I'm trying to implement a user authentication for a python s/w by use of javascript. When user clicks on a link(python cgi), a window pops-up asking for username and calls 2 diff cgi/py files to validate & log the user details.
What I need to do is after it succeeds, is to pass a variable(success/failure) back to parent at the same time closing pop-up so parent can take action depending on variable value.
the pop-up works, but passing variable by opener.retVal doesn't.
in parent:-
var retVal = 0
var handle= ''
function popup() {
handle = window.open("url", "name", "attributes")
if (handle.opener == null)
handle.opener = self
if (handle.closed)
window.alert(retVal)
}
<a href="url" onClick="popup()">Click here</a>
in child:-
function passval() {
opener.retVal = 1
}
<body onLoad="passval();self.close();">
The problem is as soon as popup window opens, the handle.closed statement is executed & fails because child is still open. How can I avoid this? How will it wait till child is closed?
I have been looking at FAQ's, & sites since morning but no answer. Sorry if my question seems too simple, but I'm hoping someone will reply. Thanks in advance.