how can I tell when a page is done reloading?

Discussion in 'Javascript' started by jaialai technology, Aug 5, 2005.

  1. I want to reload a url in a browser window so I do something like this:
    open(window.location.href= "www.yahoo.com");

    ok, so now I want to do something when that page is done loading
    completely. how do I do this?
    What I have tried is this:
    a=open(window.location.href= "www.yahoo.com");
    a.onload=b();

    function b(){
    alert("Done!!");
    }

    but none of this works. I am only concerned with IE.
    Any advice on how I can get this to work?
    My goal, if not clear from above, is to load some arbitrary page in a
    window and then do <something else>, function b(), only when that page
    is completely done loading.
     
    jaialai technology, Aug 5, 2005
    #1
    1. Advertising

  2. jaialai technology

    alu Guest

    "jaialai technology" <> wrote
    > a=open(window.location.href= "www.yahoo.com");



    See the FAQ http://jibbering.com/faq/#FAQ4_42
    & report back if you still have problems.
    -alu
     
    alu, Aug 5, 2005
    #2
    1. Advertising

  3. No, you didn't understand. I have no control over the content of the
    child window. If I did I would have used onload or whatever you
    suggested already.
    How do I tell when a child window is done loading? WHEN I HAVE NO
    CONTROL OVER THE CONTENT OF THE CHILD WINDOW.
     
    jaialai technology, Aug 5, 2005
    #3
  4. jaialai technology

    Ivo Guest

    "jaialaitech nology" wrote
    > ok, so now I want to do something when that page is done loading
    > completely. how do I do this?
    > What I have tried is this:
    > a=open(window.location.href= "www.yahoo.com");


    Two mistakes: the window.open() method takes three parameters, all optional,
    all strings, but you have a script statement there. The first parameter is
    the url to open, either relative to the current page, or absolute, in which
    case the protocol, usually http:,is required; the second and third specify
    the name and features such as bars and sizes.
    What you pass as the parameter here, is the returnvalue of the Javascript
    statement window.location.href=etc. This happens to be the string that
    contains the url, but the protocol is missing so it is interpreted
    relatively.
    What you are looking for is something like this:
    window.open( "http://www.yahoo.com" );

    > a.onload=b();


    One: When assigning a function to an event handler, you don't necessarily
    want to execute that function. Drop the brackets () and you 're fine.
    However: this will never work cross-domain. Browser built-in security
    measures prevent JavaScript from accessing pages that are not from the same
    domain. Only when you open a window with a page from your own site, can you
    attach onload event handlers and other stuff. For more on this, try
    < http://www.google.com/search?q=same origin policy >

    hth
    ivo
    http://www.ariel.shakespearians.com/
     
    Ivo, Aug 5, 2005
    #4
  5. ok, I am reporting back to say that that faq has nothing to do with
    checking the status of a child window. Thanks for not even bothering to
    read my question.
     
    jaialai technology, Aug 5, 2005
    #5
  6. after a few hours of misery I got this
    var windowReference =
    open(external.menuArguments.location.href=doc.URL);

    while(windowReference.document.readyState!="complete"){}
    <do-something>

    Which simply creates the child window and then loops until it is done
    loading. This works for what I want.
    Not sure why this took so long. seems like I had to run through quite a
    few permutatins of window rewferences and different attempts at
    ascertaining some sort of status of the child window.
     
    jaialai technology, Aug 5, 2005
    #6
  7. This newsgroups is all but dead. I wouldn't shout if there was anybody
    here with a clue. Mostly just a bunch of stupid assed curries begging
    for someone to do their work for them.
    Anyway, I ended up solving my own problem so posting here was just a
    waste of time.
     
    jaialai technology, Aug 5, 2005
    #7
  8. jaialai technology

    Ivo Guest

    "jaialai technology" wrote
    > This newsgroups is all but dead. I wouldn't shout if there was anybody
    > here with a clue.


    Well who am I to expect or even hope for the tiniest bit of thanks for
    trying to be helpful, warning for potential oversights and other forms of
    narrowmindedness, and various similarly carefully chosen words. I have seen
    quite a few newsgroups, and the discussions on this particular one happen to
    be among the friendliest and most intelligent around imho (which perhaps
    sais more about the other groups, but never mind that). Only generally
    speaking, of course.
    Here 's to a happy life, jaialai!
    hth
    ivo
     
    Ivo, Aug 5, 2005
    #8
  9. jaialai technology

    Jedi Fans Guest

    jaialai technology wrote:
    > ok, I am reporting back to say that that faq has nothing to do with
    > checking the status of a child window. Thanks for not even bothering to
    > read my question.
    >

    Stop being rude and people MIGHT read your question, being rude does not
    help somebody if they misunderstood the question, in which case -
    normally - it is the fault of the OP..

    --
    Hope This Helped and MTFBWY...
    Kieren aka JediFans - <URL:http://jedifans.com/>
    The Force Is With Me, SuSE Linux Professional 9.3, Mozilla Firefox
    1.0.6, Mozilla Thunderbird 1.5 Alpha 2 and Revenge Of The Sith!
     
    Jedi Fans, Aug 5, 2005
    #9
  10. jaialai technology

    Randy Webb Guest

    Danny said the following on 8/3/2005 12:33 AM:

    >
    > In IE, use the onreadystatechange event handler in the Body:
    >
    > <body onreadystatechange="if(this.readyState=='loaded'){....}">
    > however, onload= works the same way.


    You never cease to amaze me with your incompetence. The above only works
    if the page is from the same domain. Since the OP wanted to load an
    "arbitrary page" then it is feasible that the page is not from the same
    domain which means it is *impossible* to do the above.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
     
    Randy Webb, Aug 6, 2005
    #10
  11. jaialai technology

    Randy Webb Guest

    David Given said the following on 8/5/2005 5:05 AM:

    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1


    Please see the group FAQ with regards to PGP Signed Messages.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
     
    Randy Webb, Aug 6, 2005
    #11
  12. jaialai technology

    Randy Webb Guest

    David Given said the following on 8/8/2005 7:55 AM:
    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > Randy Webb wrote:
    > [...]
    >
    >>Please see the group FAQ with regards to PGP Signed Messages.

    >
    >
    > I had a look in 'Quick Answers' and 'META' but didn't see anything relevant
    > - --- can you provide any more detailed pointers?


    PGP Signed is not plain text, and that is covered in the FAQ,
    specifically section 2.3 and is also discussed here:

    <URL: http://www.jibbering.com/faq/faq_notes/pots1.html#ps1Txt >

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
     
    Randy Webb, Aug 8, 2005
    #12
  13. JRS: In article <>, dated Mon, 8 Aug
    2005 16:59:27, seen in news:comp.lang.javascript, Randy Webb
    <> posted :

    >PGP Signed is not plain text, and that is covered in the FAQ,
    >specifically section 2.3 and is also discussed here:
    >
    ><URL: http://www.jibbering.com/faq/faq_notes/pots1.html#ps1Txt >


    Provided that the material which is composed for signature is plain
    text, I see no need for objection; the signature itself is reasonably
    small. A good newsreader will not show the PGP stuff as sent, but just
    give an indication.

    News:uk.* practice explicitly permits their use.

    Since the FAQ notes do not appear in News, they cannot have authority in
    respect of News.

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
    Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
    Plaintext, quoting : see <URL:http://www.usenet.org.uk/ukpost.html>
    Do not Mail News to me. Before a reply, quote with ">" or "> " (SoRFC1036)
     
    Dr John Stockton, Aug 9, 2005
    #13
    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. John Lin
    Replies:
    19
    Views:
    590
    Donn Cave
    Sep 25, 2003
  2. yogesh
    Replies:
    1
    Views:
    398
    Victor Bazarov
    Mar 14, 2007
  3. Replies:
    1
    Views:
    216
    Kushal Kumaran
    Mar 24, 2007
  4. João Gomes
    Replies:
    4
    Views:
    305
    fnegroni
    Feb 8, 2008
  5. Zhidian Du
    Replies:
    0
    Views:
    178
    Zhidian Du
    Feb 21, 2004
Loading...

Share This Page