Connecting Tech Pros Worldwide Forums | Help | Site Map

FireFox Closes Window Before Opener Function Executes

badaczewski@gmail.com
Guest
 
Posts: n/a
#1: Jan 22 '07
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.

Lee
Guest
 
Posts: n/a
#2: Jan 22 '07

re: FireFox Closes Window Before Opener Function Executes


badaczewski@gmail.com said:
Quote:
>
>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.


--

RobG
Guest
 
Posts: n/a
#3: Jan 22 '07

re: FireFox Closes Window Before Opener Function Executes



Lee wrote:
Quote:
badaczewski@gmail.com said:
Quote:

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.
Or use setTimeout so it closes itself say 10ms later.

--
Rob

badaczewski@gmail.com
Guest
 
Posts: n/a
#4: Jan 25 '07

re: FireFox Closes Window Before Opener Function Executes


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.

On Jan 22, 6:18 pm, "RobG" <r...@iinet.net.auwrote:
Quote:
Lee wrote:
Quote:
badaczew...@gmail.com said:
>
Quote:
Quote:
>The following javascript appears on a popup window.
>
Quote:
Quote:
><script language="javascript" type="text/javascript">
function InsertContact(value)
{
window.opener.CallBackContact(value);
window.close();
}
></script>
>
Quote:
Quote:
>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.
>
Quote:
Change your code so CallBackContact() closes the window.Or use setTimeout so it closes itself say 10ms later.
>
--
Rob- Hide quoted text -- Show quoted text -
badaczewski@gmail.com
Guest
 
Posts: n/a
#5: Jan 25 '07

re: FireFox Closes Window Before Opener Function Executes



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.

On Jan 25, 9:58 am, badaczew...@gmail.com wrote:
Quote:
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.
>
On Jan 22, 6:18 pm, "RobG" <r...@iinet.net.auwrote:
>
>
>
Quote:
Lee wrote:
Quote:
badaczew...@gmail.com said:
>
Quote:
Quote:
The following javascript appears on a popup window.
>
Quote:
Quote:
<script language="javascript" type="text/javascript">
function InsertContact(value)
{
window.opener.CallBackContact(value);
window.close();
}
</script>
>
Quote:
Quote:
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.
>
Quote:
Quote:
Change your code so CallBackContact() closes the window.Or use setTimeout so it closes itself say 10ms later.
>
Quote:
--
Rob- Hide quoted text -- Show quoted text -- Hide quoted text -- Show quoted text -
Closed Thread