Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > how can I tell when a page is done reloading?

Reply
Thread Tools

how can I tell when a page is done reloading?

 
 
jaialai technology
Guest
Posts: n/a
 
      08-05-2005
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.

 
Reply With Quote
 
 
 
 
alu
Guest
Posts: n/a
 
      08-05-2005

"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


 
Reply With Quote
 
 
 
 
jaialai technology
Guest
Posts: n/a
 
      08-05-2005
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.

 
Reply With Quote
 
Ivo
Guest
Posts: n/a
 
      08-05-2005
"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/







 
Reply With Quote
 
jaialai technology
Guest
Posts: n/a
 
      08-05-2005
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.

 
Reply With Quote
 
jaialai technology
Guest
Posts: n/a
 
      08-05-2005
after a few hours of misery I got this
var windowReference =
open(external.menuArguments.location.href=doc.URL) ;

while(windowReference.document.readyState!="comple te"){}
<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.

 
Reply With Quote
 
jaialai technology
Guest
Posts: n/a
 
      08-05-2005
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.

 
Reply With Quote
 
Ivo
Guest
Posts: n/a
 
      08-05-2005
"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


 
Reply With Quote
 
Jedi Fans
Guest
Posts: n/a
 
      08-05-2005
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!
 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      08-05-2005
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
hi, can anyone tell me if this software can be done in C? Joćo Gomes C Programming 4 02-08-2008 02:36 PM
How can I tell when the threads that I spawn are done in python ogerchikov@gmail.com Python 1 03-24-2007 05:16 AM
CAN any one tell it whats the code tell it yogesh C++ 1 03-14-2007 01:12 PM
I asked before and was told it could not be done, well its Done...?? Karen Parker NZ Computing 32 08-27-2004 07:21 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57