SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Closing Popup Window in IE7/FF2

    Hello all,

    We have an interesting problem that (I hope) has a simple solution. Several pages on our site take some time to load due to a database call - the page that links to the slow pages create a "Processing...." popup with the following call:

    function showWaitingPopup()
    {
    goWaitingWindow = openWin(doNoCache("/include/wait.asp"),"NTILoading","scrollbars=0,resizable=0,statusbar=0", 250, 138);
    }//end showWaitingPopup

    (where openWin() is a function that returns a call to window.open()).

    The wait.asp file includes a method in the BODY tag to close itself when clicked away from or another window opens:

    <BODY TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 STYLE="CURSOR:wait;" onBlur="window.close();">

    So far so good. Up until a few weeks ago, everything was okay - the popup function fired, the "Processing..." popup displayed until the new page loaded, and then it went away automatically when the new page finished loading and focussed.

    This now seems to have broken in both IE7 and FF2.x - the popup will indeed go away if you manually click on the newly-loaded main window, but it will not go away automatically (which of course is what my bosses want!).

    My original thought was to declare the window handle as a global var in the include file where the showWaitingPopup() function is located. The popup function initializes the window handle, and the newly-loaded page would check for its existence and close it:
    [PAGE2.ASP]
    <!-- #INCLUDE VIRTUAL="/include/fGlobal.asp" -->
    ...
    function pageInit()
    {
    ...
    if (goWaitingWindow != null) {
    goWaitingWindow.close();
    }
    window.focus();
    }

    However, the new page shows goWaitingWindow as undefined - I suppose including the JS file at the top reinstantiates the var?

    Does anyone have a suggestion as to the best way around this?

    Thanks in advance

    Jim Stanley
    NTI

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solved it in Firefox anyway - turns out there's a "raise/lower windows" setting in the Advanced JavaScript tab. Probably something similar for IE.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •