Automatically open window, but not with onLoad

Discussion in 'Javascript' started by jadiyo, Feb 16, 2005.

  1. jadiyo

    jadiyo Guest

    Hi,

    I've read many questions about how to automatically open a new window
    from a page using the JavaScript onLoad command.

    Unfortunately, due to the web application framework being used
    (WebLogic Portal 7), I can not use it as it is already being used and
    is only called once by the browser(so I believe).

    What I am essentially trying to do is open a "Please wait, this may
    take some time" window while some sort data retrieval is done and then
    close it when the method has returned and the rest of the page is ready
    to be displayed.

    I appreciate this is a JavaScript forum, but any solution would be
    appreciated.

    Many Thanks

    Jadiyo
     
    jadiyo, Feb 16, 2005
    #1
    1. Advertising

  2. jadiyo

    Randell D. Guest

    jadiyo wrote:
    > Hi,
    >
    > I've read many questions about how to automatically open a new window
    > from a page using the JavaScript onLoad command.
    >
    > Unfortunately, due to the web application framework being used
    > (WebLogic Portal 7), I can not use it as it is already being used and
    > is only called once by the browser(so I believe).
    >
    > What I am essentially trying to do is open a "Please wait, this may
    > take some time" window while some sort data retrieval is done and then
    > close it when the method has returned and the rest of the page is ready
    > to be displayed.
    >
    > I appreciate this is a JavaScript forum, but any solution would be
    > appreciated.
    >
    > Many Thanks
    >
    > Jadiyo
    >


    There are two things you could do - You could change the function called
    in your onLoad to call something else... and have its value contained
    inyour new function... thus if onLoad="someRoutine();" then you could
    create a new function called newFunction and have it call someRoutine()
    and to perform your window.open... Then change onLoad to call newFunction.

    Failing that... you could just put in a window.open call in a piece of
    inline javascript... this would be called automatically when read (put
    it at the end of your HTML, just inside the </BODY> tag to ensure its
    run late...

    Does that help you any?

    (I gather you've already thought about the number of browsers out there
    that would disable popups)

    randelld
     
    Randell D., Feb 16, 2005
    #2
    1. Advertising

  3. jadiyo

    RobB Guest

    jadiyo wrote:
    > Hi,
    >
    > I've read many questions about how to automatically open a new window
    > from a page using the JavaScript onLoad command.
    >
    > Unfortunately, due to the web application framework being used
    > (WebLogic Portal 7), I can not use it as it is already being used and
    > is only called once by the browser(so I believe).
    >
    > What I am essentially trying to do is open a "Please wait, this may
    > take some time" window while some sort data retrieval is done and

    then
    > close it when the method has returned and the rest of the page is

    ready
    > to be displayed.
    >
    > I appreciate this is a JavaScript forum, but any solution would be
    > appreciated.
    >
    > Many Thanks
    >
    > Jadiyo


    window.onload isn't a 'command', it's an object property, assigned like
    any variable. It's called as window.onload() when the event for which
    it is named - Load in this case - fires. The challenge is not to
    overwrite any previously made assignments to it when adding new
    listeners. DOM addEventListener() was designed for this, encapsulating
    the process so it can be done non-destructively. Unfortunately, *all*
    listeners need to be registered this way for it to succeed. Here's a
    way to assign a new onload handler without overwriting the old:

    var oldhandler = window.onload;
    window.onload = function()
    {
    if (oldhandler)
    oldhandler();
    newhandler();
    }

    hth
     
    RobB, Feb 16, 2005
    #3
  4. jadiyo

    Randell D. Guest

    RobB wrote:

    > jadiyo wrote:
    >
    >>Hi,
    >>
    >>I've read many questions about how to automatically open a new window
    >>from a page using the JavaScript onLoad command.
    >>
    >>Unfortunately, due to the web application framework being used
    >>(WebLogic Portal 7), I can not use it as it is already being used and
    >>is only called once by the browser(so I believe).
    >>
    >>What I am essentially trying to do is open a "Please wait, this may
    >>take some time" window while some sort data retrieval is done and

    >
    > then
    >
    >>close it when the method has returned and the rest of the page is

    >
    > ready
    >
    >>to be displayed.
    >>
    >>I appreciate this is a JavaScript forum, but any solution would be
    >>appreciated.
    >>
    >>Many Thanks
    >>
    >>Jadiyo

    >
    >
    > window.onload isn't a 'command', it's an object property, assigned like
    > any variable. It's called as window.onload() when the event for which
    > it is named - Load in this case - fires. The challenge is not to
    > overwrite any previously made assignments to it when adding new
    > listeners. DOM addEventListener() was designed for this, encapsulating
    > the process so it can be done non-destructively. Unfortunately, *all*
    > listeners need to be registered this way for it to succeed. Here's a
    > way to assign a new onload handler without overwriting the old:
    >
    > var oldhandler = window.onload;
    > window.onload = function()
    > {
    > if (oldhandler)
    > oldhandler();
    > newhandler();
    > }
    >
    > hth
    >


    I didn't make the OP but I do like the solution... its simple and
    tidy... nice!

    randelld
     
    Randell D., Feb 16, 2005
    #4
  5. jadiyo

    jadiyo Guest

    Thanks.
    I used the simple inline javascript. I appreciate the popup issue, but
    if I go down the route of writing a nice please wait page like BA and
    Expedia, it could take some time to do in weblogic portal.

    Jadiyo
     
    jadiyo, Feb 17, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fabio R.
    Replies:
    0
    Views:
    833
    Fabio R.
    Mar 25, 2005
  2. Matt
    Replies:
    1
    Views:
    482
    Michael Winter
    Aug 22, 2004
  3. David Otton

    window.onload and body.onload differences

    David Otton, Nov 4, 2004, in forum: Javascript
    Replies:
    2
    Views:
    599
    Martin Honnen
    Nov 4, 2004
  4. Replies:
    5
    Views:
    296
    Thomas 'PointedEars' Lahn
    May 15, 2005
  5. Replies:
    2
    Views:
    417
Loading...

Share This Page