Hi,
You can hook the 'load' event on the return value from `window.open`:
var wnd = window.open(...);
Event.observe(wnd, 'load', childLoaded);
That will only work if the window you're loading and the window
loading it are from the same origin.[1] And of course, the window.load
event happens fairly late, after all the images have been loaded.
JavaScript in your child window can call into your parent window to
tell it when it's ready. Assuming you have Prototype loading in your
*child* window, it would be something like this:
In a script tag in the child window:
document.observe("dom:loaded", phoneHome);
function phoneHome() {
if (window.opener && window.opener.readyCallback) {
window.opener.readyCallback(window);
}
}
In a script tag in the parent window:
function readyCallback(child) {
/* do something */
}
That will happen earlier than window.load (because Prototype's
dom:loaded event happens as early as possible). I'm 99% sure they
still have to be from the same origin, I don't think window.open
grants the child any special access rights to the parent. (I'm sure it
doesn't grant the parent special rights to the child.)
[1] http://en.wikipedia.org/wiki/Same_origin_policy
HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com
On Apr 2, 9:14 pm, Hariz Soleminio <[email protected]>
wrote:
> Hi Guys,
>
> is there a possible way to check from mother window if I open up a window is
> ready
> using window.open? like passing up the value to the mother window. In
> prototype way.
>
> I'll be making an ajax effect like progress bar if the window is not ready
> yet...
>
> Thanks
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.