473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how can I tell when a page is done reloading?

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.

Aug 5 '05 #1
16 2921

In IE, use the onreadystatechange event handler in the Body:

<body onreadystatechange="if(this.readyState=='loaded'){ ....}"> however,
onload= works the same way.
Danny
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Aug 5 '05 #2
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.

Aug 5 '05 #3
Ivo
"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/



Aug 5 '05 #4
alu

"jaialai technology" <ja****************@gmail.com> 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
Aug 5 '05 #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.

Aug 5 '05 #6
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.

Aug 5 '05 #7
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jaialai technology wrote:
[...]
Which simply creates the child window and then loops until it is done
loading. This works for what I want.
You realise that if you busy wait like this for too long, there's a fair
chance that the client's web browser will decide that the script's crashed
and nuke it? This may be triggered by, for example, a slow 'net connection.
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.


You're probably running afoul of the security rules --- there isn't much you
can do with a frame or window containing a page belonging to a different
domain.

BTW: you might get more people willing to help if you didn't shout so much.
Some of your other messages are definitely a bit on the rude side.

- --
+- David Given --McQ-+ "The sky was the perfect untroubled blue of a
| dg@cowlark.com | television screen, tuned to a dead channel." ---
| (dg@tao-group.com) | Neil Gaiman, _Neverwhere_
+- www.cowlark.com --+

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC8yvqf9E0noFvlzgRAqerAKDM/jdheKD6QB0D/eQYagbvTWOHvwCfTgmU
VcXTplyl6uuYuDZGY9bjy9M=
=CJHJ
-----END PGP SIGNATURE-----
Aug 5 '05 #8
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.

Aug 5 '05 #9
Ivo
"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
Aug 5 '05 #10
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!
Aug 5 '05 #11
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
Aug 5 '05 #12
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
Aug 5 '05 #13
-----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?

- --
+- David Given --McQ-+ "Information wants to be free, but my mail client
| dg@cowlark.com | does not want to be chock-full of herbal pot
| (dg@tao-group.com) | alternative spam." --- Sant Lupus on Slashdot
+- www.cowlark.com --+

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC90jlf9E0noFvlzgRAg3OAKDWwz1HcuWMUhH9gIpT1L TW3bsFeQCgocVm
UoWdCM49xinbpq2qqSgVBJI=
=fdeP
-----END PGP SIGNATURE-----
Aug 8 '05 #14
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_not...s1.html#ps1Txt >

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Aug 8 '05 #15
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Randy Webb wrote:
[...]
PGP Signed is not plain text, and that is covered in the FAQ,
specifically section 2.3 and is also discussed here:


It is plain text, with annotations. I'm sorry, but I have no intention of
not signing my messages. Feel free to killfile me if you like, but I feel
that preventing spoofing of my messages outweighs any (very tiny) drawbacks
to signing my messages --- Usenet is not a nice place.

- --
+- David Given --McQ-+
| dg@cowlark.com | "While I write this letter, I have a pistol in one
| (dg@tao-group.com) | hand and a sword in the other." --- Sir Boyle Roche
+- www.cowlark.com --+

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC+Oi8f9E0noFvlzgRAqm0AKCQoPr0yneGWqLDdImLLC Yl+v5oIgCaAz8e
nZQ46eR0LpbTll9A0IFa9Bg=
=PBnq
-----END PGP SIGNATURE-----
Aug 9 '05 #16
JRS: In article <TJ********************@comcast.com>, dated Mon, 8 Aug
2005 16:59:27, seen in news:comp.lang.javascript, Randy Webb
<Hi************@aol.com> 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_not...s1.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)
Aug 9 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jbj | last post by:
Something like a php function that can be called? I have php in a page that needs to be update periodically (basically poll results) without reloading the page around it (I do have a button you...
2
by: Alex Hunter | last post by:
Is it possible for one page to access a variable (or text) from another page or frame? How is this done? I want to update a piece of data on one page, and have it update on lots of different...
3
by: micchy | last post by:
Dear everyone, I'd like to know if 'view-source' in javascript can work without reloading the page. (or not calling the page again, just as I right-click in IE) Thanks for your help! micchy
2
by: Jack David | last post by:
I have a requirement to build the following: 1: A user logs onto the web application using a user name and password (Done) 2: The user is presented with a web page that contains 3 frames (Done)...
1
by: Mad Scientist Jr | last post by:
How do you get a ASP.NET page to return nothing, so the page posting form data to it doesn't reload? I have tried all combinations of the following: Response.SuppressContent = True...
3
by: Richard | last post by:
Hey there, I have a textbox and a listbox. When a user types a number in the textbox, I want to get all the records from a MS Access DB but without reloading the page. I now have something...
1
by: Alex Gurevich | last post by:
Hi, I am having very strange problem, I have Dropdownlist (DDL) with callback function for SelectedIndexChanged event on asp.net page, which is populated in codebehind Page_OnLoad page. After...
10
by: Martien van Wanrooij | last post by:
In a simple webshop application I am trying to check that the "shopping cart" only should be "filled" when you choose an article in "meerinfo.php" and click on a link to "winkelwagen.php". It...
4
by: BigZero | last post by:
Hello ppl, I have any index page that already as lot of information to display i wanted to make it as the index page should display one image for 5 second and after 5 second the rest data but...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.