473,661 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FireFox (version 2) Ajax call to update page times out if child window is closed

Frinavale
9,735 Recognized Expert Moderator Expert
I have 2 FireFox (version 2) browser windows opened.

One is the child of the other.

When the user is finished with the child window, a method in the parent window is called to refresh a section of the page.

This is the JavaScript code that I'm using to refresh the content in the parent page:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">           
  2.             function UpdateList() {
  3.                 showUpdatingMessage();
  4.                 document.getElementById('myHiddenFieldForStuff').value = true;
  5.                 __doPostBack('myASPButtonClientID', '');
  6. }
  7.  </script>
Please note that the __doPostBack() method is supplied by ASP.NET. This method submits the page to the server and indicates that the control that caused this to happen was a button with the ClientID of "myASPButtonCli entID". This method determines whether or not the whole page should be updated or if an asynchronous call to the server should take place. Since the button with the clientID of "myASPButtonCli entID" is within an ASP.NET UpdatePanel, the __doPostBack() method preforms an asynchronous call to the server and only a portion of the page is updated.

This is the JavaScript code in the child page that is used to call the UpdateList JavaScript method in the parent page:
Expand|Select|Wrap|Line Numbers
  1.   <script type="text/javascript">
  2.             window.onbeforeunload = CloseEvent;
  3.  
  4.             function CloseEvent() {
  5.                 if (window.opener && !window.opener.closed) {
  6.                     window.opener.UpdateList();
  7.                 }
  8.             }
  9.             function CloseBrowserWindow() {
  10.                 //window.close();
  11.                 CloseEvent();
  12.             }
  13.         </script>
The "CloseBrowserWi ndow" method is called when a Button is clicked. It's supposed to close the window, which triggers the window.onbefore unload event to fire, which calls the method in the parent window.

Right now the JavaScript responsible for closing the browser window is commented-out. The reason is because in FireFox version 2, when the child window is closed, the postback to the server times out.

When the child window remains opened, the request does not time out and everything works as it should (as it does in FireFox 3).

I'm not sure why this is happening (in FireFox version 2..) It'd be nice to know the reason but I'm not expecting JavaScript experts to know the mysteries of FireFox (version 2)

As a work around, I was thinking that if I were able to close the child window from the parent window the problem could be averted.

The only thing is, I have no idea how to do this.

I'd really appreciate any insight on this topic.

Thanks,

-Frinny
Mar 12 '09 #1
29 3897
gits
5,390 Recognized Expert Moderator Expert
could you try to trigger the close event after the request is completed? i guess that the problem is that by closing the browser-window the reference to the current request object is dropped ... you could even try a timeout for the close-operation which should even avoid that behaviour ... i say i guess it because i don't know the exact reason but anytime we have that problem both of the solutions fix it ...

may be i'll investigate it a bit and could give a better answer ;)

kind regards
Mar 12 '09 #2
Frinavale
9,735 Recognized Expert Moderator Expert
@gits
I'm not following? I don't understand what you're getting at here.....

@gits
I have no idea how long the update's going to take. It's a very complicate page with many things that need updating. So, it's not a very quick process...and when you combine that with a little bit of lag, how can you tell how long it's going to take?

[edit]
Oh wait, do you mean put put a timeout in the parent window to allow the close-operation in the child window to take place before raising the post back to the server?
[/edit]
Mar 12 '09 #3
gits
5,390 Recognized Expert Moderator Expert
is UpdateList() an Ajax-operation? then you could just call to close the window in the callback of the request.

in case you want to use the timeout then you just need a short one ... as i said ... it fixes such issues and i guess again :) that the timeout just avoids the reference dropping and let the browser instantiate and bind the requestobj correctly
Mar 12 '09 #4
gits
5,390 Recognized Expert Moderator Expert
regarding your edit ... i thought that something like this:

Expand|Select|Wrap|Line Numbers
  1. function CloseBrowserWindow() {
  2.     CloseEvent();
  3.     window.setTimeout(function() { 
  4.         window.close(); 
  5.     }, 100);
  6. }
should help.

kind regards
Mar 12 '09 #5
Frinavale
9,735 Recognized Expert Moderator Expert
So, you don't close the child window from the parent window then?
Mar 12 '09 #6
gits
5,390 Recognized Expert Moderator Expert
as far as i'm aware of this behaviour that doesn't matter ... it is a problem of closing a window 'the same time' when starting a request ... so it could be circumvented by using a timeout ... that is just the experience i made ..
Mar 12 '09 #7
Frinavale
9,735 Recognized Expert Moderator Expert
I added the suggested code and it did not solve the problem.
I'm still getting a time out message in the parent window if the client window is closed even though there is a timeout set.
Mar 12 '09 #8
Frinavale
9,735 Recognized Expert Moderator Expert
@gits
This behaviour seems to be linked to my earlier question...
Mar 12 '09 #9
gits
5,390 Recognized Expert Moderator Expert
is it an Ajax-Request that does the update?
Mar 12 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
6944
by: GEL | last post by:
Hi, I want to open a new browser window, let the user use that window for several minutes, and when they close, I'd like to change the page displayed in the original window. According to numerous articles found Googling, this should work, but on my WinXP system, using Firefox and IE, I get nothing (when allowing pop-ups, if pop-ups are disabled, IE reports the window is closed, Firefox gives a JS error on checking the window handle). No...
3
2283
by: torbs | last post by:
Hi I have two quicktime plugins embedded in a webpage. I want to hide one and display the other. Then I want to load a movie into the hidden player. When the first player is finished playing, I hide it, and show the hidden player. In IE I do this by setting the z-index of the quicktime objects. This however do not work in other browsers. Is there a way to stack two players on top of each other using the z-index with plugins?
3
2288
by: robert.oschler | last post by:
I have an AJAX driven page where I dynamically add rows to a known table on the page, based on the return document from the AJAX call, using DOM node methods (except for a small snippet of code, see below) .. The code I use to do that is shown below. The code runs fine in FireFox. I can see the newly created table rows and everything looks fine on the page. In Internet Explorer, I don't see any changes to the page after the new nodes...
5
3104
by: Rabia | last post by:
I am using the window.open() with modal=yes to simulate the pop up window as modalDialog in mozilla/firefox. The pop-up window (child) has a few options which the user selects and then click the submit button. What i need to do on this submit button click is to return the value from the child to the parent window, close the child window and reload the parent page to reflect the changes as selected in the child window. Can anybody...
4
5124
by: tcole6 | last post by:
My problem appears to be Firefox specific. I have a hyperlink that loads a new window. This window contains hyperlinks that call javascript functions in the parent window and then closes the child window. The function that is called contains an XMLHttpRequest. My problem is that everything happens as it should, the innerHTML is changed by the results of the XMLHttpRequest and the child window closes. The problem is this, in Firefox,...
4
7458
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole new page that should replace an existing one. I.e when we issue an Ajax request we don't know what will be returned and analyze the response to act accordingly. Now, the way to replace the current document with a new one used to be easy and...
2
4547
by: germ | last post by:
doing a simple page webmethod call an a page via PageMethods works fine in ie7 & opera9 the same call on firefox ( and I assume netscape ) generates the following error : Error: " nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://hgha.gerzio.ca/ScriptResource.axd?d=3Ot8FdrYMQ58gwjNF6tbd8V5YtBKDtb8a6qI5cjRJWaZBQhYu2jjDRnc7N0IverhgY8x7LACpAIvqLPvNyERF0ui1Tz1p-s2eu0h41S_qMA1&t=633179517344763787 ::...
2
2719
by: Joe Stateson | last post by:
Not sure what is going on. I have a treeview of an XmlDataSource with cacheing enabled. With only a few nodes there is no problem on a postback, the treeview is repainted immediately. With a lot of nodes and many many leaves, it can take 2 minutes for a repaint. Both running in debug (VS2005) or just running the web page from the wwwroot server using IE7. However, if I bring up FireFox to view the page, the repaint takes only a second....
1
1325
by: Just Me | last post by:
OK, Heres the deal. VS2005, AJAX 1.1, Menu With Child Items Inside UpdatePanel. Why, because Im using ajax and need to dynamically update the enabled state of one of the menu options. Problem, if I cause an async request anywhere on the page then quickly hover over the memu item with child items underneath it, they display while the request is going on, if I move the mouse cursor off the menu before the
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.