Topic: How to tell when a child iframe has "loaded" (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: California |
posted 07-10-2004 01:18
Is there some way / script which can be placed in a page which will trigger some code when a contained iframe has finished loading? Basically the equiv of <iframe src="foo" onload="bar"/> |
Paranoid (IV) Inmate From: France |
posted 07-10-2004 08:58
whisperstom: You shouldn't attach the events on the iframe itself but on/in its own document, body, ... just like any page. If the location of the iframe is on the same domain as that of the main window, it's possible to attach an onload event on the iframe via JavaScript. Otherwise it's not possible for security reasons. Whatever, for the iframe, the main window IS its parent so you the function called onload in the iframe can do things on its parent. For example, the source code of the page in the iframe could look like : code: <script type="text/javascript"> Like I just said in want 2 change background color of a page from external site when refernced within a frame, you must use the window object and its properties like parent, top, frames, ... |