473,657 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.loc ation.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.l ocation.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 2944

In IE, use the onreadystatecha nge event handler in the Body:

<body onreadystatecha nge="if(this.re adyState=='load ed'){....}"> 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
"jaialaitec h 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.l ocation.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.l ocation.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.m enuArguments.lo cation.href=doc .URL);

while(windowRef erence.document .readyState!="c omplete"){}
<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)

iD8DBQFC8yvqf9E 0noFvlzgRAqerAK DM/jdheKD6QB0D/eQYagbvTWOHvwCf TgmU
VcXTplyl6uuYuDZ GY9bjy9M=
=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
narrowmindednes s, 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

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

Similar topics

3
2604
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 can click). Is this possible? Or should I make some sort of Iframe with the php page in it that could be reloaded. The php code basicaly just writes a table to the page with the results of the polls included. Thanks for the help.
2
11162
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 pages. I thought I could define the data as a variable on one page, and have all the other pages look at and display the variable from that page. Both pages could be open in a frameset. I have no idea how to do this, Is it possible? Could a...
3
2545
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
1624
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) 3: Based on some event that takes place within the system, I want to display a specific page in one of the frames in the page that is displayed to the user......This may happen a number of times while the user is logged into the session.
1
8017
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 Response.BufferOutput = True Response.Cache.SetNoStore()
3
2151
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 manual and a user first must press a button to get the listbox filled with records but I want to have it done automaticly without pressing a sumbit button. I know its prolly done with javascript but thats one thing
1
2574
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 postback of the page, througth on click event of a button on the page, and returning of the page to client side, usually selection of an item in the DDL trigers reloading of the page but not as a postback. Afterwads if you select another item in...
10
3779
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 works fine in that sense that when I would enter in the browser "www.mysite.php/winkelwagen?id=5"it will be ignored. However when I go from meerinfo.php to winkelwagen.php , the article is added again and again to the shopping cart when I click on...
4
2931
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 not the image. how to clean the old data or image from single loaded page. "All i m looking for display image for 5 second after 5 second clear image and show the rest data"
0
8315
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.