var wm = Components.classes['@mozilla.org/appshell/window-mediator;
1'].getService(Components.interfaces.nsIWindowMediator);
var enumerator = wm.getEnumerator(null);
var retval = [];
while (enumerator.hasMoreElements()) {
retval.push(enumerator.getNext());
}
var wins = retval;
The above wins variable will contain an array of all the windows open.
Initially it will show 1 window object[object ChromeWindow] only.
Now go to this website http://www.w3schools.com/js/tryit_view.asp?filename=tryjs_alert
and click on the alert box.
Run the above command again and you will find wins array contains 2
ChromeWindow objects.
The alert window is a modal window.
Can anyone tell me how do i know what is the parent window of this
modal window?
other words - How do i find the parent window of the alert window?
My problem is ... i might have n number of windows open.
I will be working on a particular chrome window object.
Will do certain action on the chrome window object like click a
button, which might result in a javascript alert box or confirm dialog
which popups up.
I would like to handle this javascript popup that gets generated from
this chromewindow that iam working on only.
In other words i would like to get a hold of the javascript popup
object that was created from the parent window.
I cant seem to find any relation to the parent window from the
javascript popup object..
Can anyone help me on this ...
Thanks,
Tony
On Nov 20, 6:10 pm, Tony <ynot...@gmail.com> wrote:
> Hi,
>
> var wm = Components.classes['...@mozilla.org/appshell/window-mediator;
> 1'].getService(Components.interfaces.nsIWindowMediator);
> var enumerator = wm.getEnumerator(null);
> var retval = [];
> while (enumerator.hasMoreElements()) {
> retval.push(enumerator.getNext());}
>
> var wins = retval;
>
> The above wins variable will contain an array of all the windows open.
> Initially it will show 1 window object[object ChromeWindow] only.
>
> Now go to this websitehttp://www.w3schools.com/js/tryit_view.asp?filename=tryjs_alert
I don't know about 'parent' but for the alert box Chromebug shows
window.opener is the w3schools site. There is documentation for opener on
https://developer.mozilla.org/en/DOM/window
but not on
https://developer.mozilla.org/en/XUL/window
jjb
Thanks a lot, it worked ....
winobject.opener.document.location - gave me the parent link
Now can make out if the window was opened by which parent browser.
Thanks,
Tony
On Nov 30, 9:51 am, "John J. Barton" <johnjbar...@johnjbarton.com>
wrote: