how can I tell when a page is done reloading?

  • Thread starter jaialai technology
  • Start date
J

jaialai technology

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.
 
J

jaialai technology

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.
 
I

Ivo

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/
 
J

jaialai technology

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.
 
J

jaialai technology

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.
 
J

jaialai technology

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.
 
I

Ivo

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
 
J

Jedi Fans

jaialai said:
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..
 
R

Randy Webb

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.
 
R

Randy Webb

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.
 
R

Randy Webb

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 >
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Mon, 8 Aug
2005 16:59:27, seen in Randy Webb
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.

practice explicitly permits their use.

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top