frame callback for when the frame finishes loading?

J

Jason S

Is there some kind of callback function I can use to tell when a frame
finishes loading?

e.g.:

window.frame[1].location = 'http://...';
window.frame[1].on_finish_loading = function() { alert('i am finished
loading'); }
 
E

Erwin Moller

Jason said:
Is there some kind of callback function I can use to tell when a frame
finishes loading?

e.g.:

window.frame[1].location = 'http://...';
window.frame[1].on_finish_loading = function() { alert('i am finished
loading'); }

Hi,

Why not simply put an onLoad handler in the document you are loading?
From there you can use top.frames.etc to communicate with other
frames/windows, and tell them the document is loaded.

(I don't know any way to check if the window in the frame has loaded
from outside the document itself that loaded.)

Regards,
Erwin Moller
 
D

David Golightly

Jason said:
Is there some kind of callback function I can use to tell when a frame
finishes loading?

window.frame[1].location = 'http://...';
window.frame[1].on_finish_loading = function() { alert('i am finished
loading'); }

Hi,

Why not simply put an onLoad handler in the document you are loading?
From there you can use top.frames.etc to communicate with other
frames/windows, and tell them the document is loaded.

(I don't know any way to check if the window in the frame has loaded
from outside the document itself that loaded.)

Regards,
Erwin Moller

You can put an "onload" event handler on the iframe itself from the
parent document. (FWIW, you can also do this with img tags.) For
best results, attach the event handler before setting the location of
the iframe's window:

window.frame[1].onload = function () { alert('loaded'); };
window.frame[1].location = url;

should get you on the right track.

-David
 
J

Jason S

You can put an "onload" event handler on the iframe itself from the
parent document. (FWIW, you can also do this with img tags.) For
best results, attach the event handler before setting the location of
the iframe's window:

window.frame[1].onload = function () { alert('loaded'); };
window.frame[1].location = url;

should get you on the right track.

-David

Thanks, I'll try that. This is a bookmarklet I'm writing to tweak a
webpage from another site that I have no control over. I'd make my own
parent document, but then it doesn't share the same domain name & I
can't get programmatic access to the frame contents because of the
security limitations.
 

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

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top