473,406 Members | 2,894 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,406 software developers and data experts.

Detecting when a page has loaded in a sub frame via javascript?

Hi
Given a web page using frames, is there anyway the left frame can request a
page in the right frame and, most importantly, detect when it has fully
loaded?
Ideally this requires no changes to the original web page being loaded on
the right.
Something like document.frame2.fullyLoaded? You get the idea

Thanks
F
Jul 20 '05 #1
3 8334


fo******@yahoo.co.uk wrote:
Given a web page using frames, is there anyway the left frame can request a
page in the right frame and, most importantly, detect when it has fully
loaded?
Ideally this requires no changes to the original web page being loaded on
the right.


With IE5.5/6 on Win you could from the first frame call

parent.document.getElementsByTagName('frame')[1].attachEvent('onload',
function (evt) {
// just an example, handle the load event here
alert(evt ? evt.type : event.type);

}
);

and then set
parent.frames[1].location = 'whatever.html';
With Mozilla and Netscape 7 you can from the first frame call

parent.document.getElementsByTagName('frame')[1].addEventListener('load',
function (evt) {
alert(evt ? evt.type : event.type);
},
true
);

and then set
parent.frames[1].location.href = 'whatever.html'

With other browsers you will have to use <body onload> in the document
loaded in the frame

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
thats fantastic thank you!

one other thing though...

will this tell me when the page has fully finished loading? i.e. all
images loaded and all possibly all scripts on the page run?

anyway way of finding out if the page didn't load correctly? guessing
something
like <pseduo code> if(body.text == "couldn't find page requested")
</pseudo code> or better

Thanks for you help

F
Jul 20 '05 #3
On 27 Feb 2004 01:51:15 -0800, <fo******@yahoo.co.uk> wrote:

[snip - use of unload event]
will this tell me when the page has fully finished loading? i.e. all
images loaded and all possibly all scripts on the page run?
Maybe, maybe not. There's no real way of telling. Different browsers use
different criteria when determining whether a page has loaded. Some
include images - some may even include Flash objects and Java applets.
anyway way of finding out if the page didn't load correctly?


[snip]

The only assured way of determining if a page loaded or not is by checking
the HTTP Response Status header, as servers may return any document when a
resource can't be loaded (so checking the contents of the page is a
possibility). Unfortunately, JavaScript cannot read the Response codes (it
can't read HTTP headers in general).

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #4

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

Similar topics

5
by: RootShell | last post by:
Hello I need to have a way to check if the user as refreshed the current page. Is there any way in PHP to do this? Here's the full facts, I have a JavaScript running that is merely a 30...
4
by: Catherine Lynn Smith | last post by:
Is there a way in ASP to figure out if a page that is being loaded is being loaded into a frameset? I know I can code this in javascript, but I would prefer to only inject a chunk of 'onload' code...
9
by: Martin Waller | last post by:
Hello, I've been playing with the idea of just how to use an ASP page to provide a remote function call. In an ideal world this would be a web service but how can you do it if restricted to ASP...
2
by: Halldór Ísak Gylfason | last post by:
In my application I have an iframe that is empty (and not visible) initially, however when a user presses a button a form is programmatically submitted and the target is set to the IFrame. I...
1
by: Unregistered | last post by:
I'm making an Intranet site for someone who is not very familiar wit making websites, thus I would like to make it as simple as possible fo her when she needs to update it. The intranet site...
3
by: Dag Sunde | last post by:
Is there a way to detect if the reason an onUnload() handler was called originated from the user explicitly refreshed the page(s)? Ie. pressed "Ctrl-R", "F5" or klicked the refresh button in...
1
by: Wim | last post by:
Hi Everyone, I'm trying to speed up a Asp.net 1.1 applications' performance. The application needs to run in an environment with little bandwith and therefore pagesizes and roundtrip times shoud...
6
by: sylcheung | last post by:
Hi, How can I be notified when the document load is complet in JavaScript? I am referring to the whold document load is complete, mean all images/external files/frame/iframes have been loaded. ...
3
by: bfmcfarlane | last post by:
I have an appication that allows users to upload and download files. This application is only accessed when a user clicks on an "Upload / Download" link from within our main application. A new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.