[Project_owners] obtaining reference to new tab

Eric H. Jung grimholtz at yahoo.com
Wed Dec 7 11:14:27 EST 2005


Hi, I tried the following. Still not luck. I'd rather not register a
listener for all windows and compare my target to aProgress.DOMWindow
because this seems like a lot of overhead, no? Am I doing something
wrong below?

var wm =
  Components.classes["@mozilla.org/appshell/window-mediator;1"]
  .getService(Components.interfaces.nsIWindowMediator);

var win = wm.getMostRecentWindow("navigator:browser");

win.addEventListener("load",
  function() {dump("hello from onload callback\n");}, false);

printWindow = win.open("about:blank");

// This addEventListener() seems like it's too late
printWindow.addEventListener("load",
  function() {dump("hello from onload callback\n");}, false);

Thank you,
Eric

--- "Eric T." <cougio at gmail.com> wrote:

> It seems your attaching the progressListener to the current window
> and
> want to watch event in a new window ("win.open()" at the end...)
> 
> Try something like registering listener for all windows and comparing
> your target to aProgress.DOMWindow, or registering your listener on
> the window's onload event. After that you might need to check if the
> status is 0 before using the event in listener...
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Project_owners mailing list