[Project_owners] Global listeer

Michael Vincent van Rantwijk, MultiZilla mv_van_rantwijk at yahoo.com
Thu Nov 15 14:34:24 PST 2007


joe ertaba wrote:
> ok, thanks, at last i can make it works !
> 
> now would you please tell me for example how to open a window when my topic
> fires
>          dump("My topic fires")              //Works
>          window.open("chrome://..")       //does not work

Have you checked your JavaScript/error console because 'window' might 
not be what you think it is, but you can use something like this:

   observe: function(aSubject, aTopic, aData)
   {
     switch (aTopic) {
       case "domwindowopened":
         var self = this;
         var window = aSubject;
         window.addEventListener("load",
           function() {
             self._onWindowOpened(window);
             window.removeEventListener("load", arguments.callee, false);
           },
           false);
         break;
   ...

   _onWindowOpened: function(aWindow)
   {
     if (aWindow.document.documentElement.getAttribute("windowtype") != 
"navigator:browser")
       return;
   ...

That gives you the 'right' (chrome) window object ;)

-- 
Michael Vincent van Rantwijk
- MultiZilla Project Team Lead
- XUL Boot Camp Staff member (ActiveState Training Partner)
- iPhone Application Developer



More information about the Project_owners mailing list