FireFox Closes Window Before Opener Function Executes

B

badaczewski

The following javascript appears on a popup window.

<script language="javascript" type="text/javascript">
function InsertContact(value)
{
window.opener.CallBackContact(value);
window.close();
}
</script>

I'm trying to tell the opener page to execute a function to refresh a
dropdown and then close the window. Unfortunatly this doesn't work in
FireFox. The window appears to close before it tells the opener to
execute it's function. If I comment out the window.close() Firefox will
execute the function and refresh the dropdown. Wrapping the
window.close in a setTimeout works but is not an option for my solution.
 
L

Lee

(e-mail address removed) said:
The following javascript appears on a popup window.

<script language="javascript" type="text/javascript">
function InsertContact(value)
{
window.opener.CallBackContact(value);
window.close();
}
</script>

I'm trying to tell the opener page to execute a function to refresh a
dropdown and then close the window. Unfortunatly this doesn't work in
FireFox. The window appears to close before it tells the opener to
execute it's function. If I comment out the window.close() Firefox will
execute the function and refresh the dropdown. Wrapping the
window.close in a setTimeout works but is not an option for my solution.

Change your code so CallBackContact() closes the window.
Get rid of the "language" attribute while you're at it.


--
 
B

badaczewski

Using setTimeout is inconsistent. If I set 100 milliseconds for the
setTimeout and access my pages over an internal network the 100ms is
enough time to process the opener page reload and then close the popup.
If I access the same pages remotely over a cable broadband connection
the 100ms isn't enough time and I need to increase it further to 200ms.
I don't like the setTimeout solution because it is too variable on the
connection and involves guess work on when the parent page will finish
processing.

Lee, I will try out your solution.
 
B

badaczewski

Naa,

Even placing the window.close() on the opener page in the method I'm
targeting from the popup doesn't work. Its like the window.close()
steals focus or something and cancels out the operation of the code
before it. By the way, this problem is only occuring in FireFox.

Using setTimeout is inconsistent. If I set 100 milliseconds for the
setTimeout and access my pages over an internal network the 100ms is
enough time to process the opener page reload and then close the popup.
If I access the same pages remotely over a cable broadband connection
the 100ms isn't enough time and I need to increase it further to 200ms.
I don't like the setTimeout solution because it is too variable on the
connection and involves guess work on when the parent page will finish
processing.

Lee, I will try out your solution.

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top