Persist a xul iframe document after hiding/showing it

Talk about add-ons and extension development.
cagribalkesen
Posts: 1
Joined: April 27th, 2008, 1:00 pm
Contact:

Solution from google notebook

Post by cagribalkesen »

I was also looking for a solution for the mentioned problem and I delved into the code of google notebook and find out the following useful code snippet, it may also be helpful to you (they are using the window.open hack as mentioned) :

Code: Select all

   var ethsms_gui_win = null;
   
   //their positioning code for the newly opened window
   function positionGUI(){
      var win=window;
      var extraY=win.document.getElementById("status-bar").boxObject.height+win.outerWidth-win.innerWidth;
      var extraX=20;
      var candidateX=win.screenX+win.outerWidth-ethsms_gui_win.outerWidth-extraX;
      var candidateY=win.screenY+win.outerHeight-ethsms_gui_win.outerHeight-extraY;
      
      if(candidateX>0&&candidateY>0){
         ethsms_gui_win.screenX=candidateX;ethsms_gui_win.screenY=candidateY;
      }
   }

   /* for opening and closing the window */   
   function toggleETHSmsGUI(){
      if( ethsms_gui_win == null ){
         //the parameters that they are using for opening a window
         var features = ["chrome","resizable=no","dependent","alwaysRaised","titlebar=no"].join(",")
         ethsms_gui_win = window.open("chrome://ethsms/content/ethsms_gui.xul", "ethsms_gui", features);
         ethsms_gui_win.innerWidth = 300;
         ethsms_gui_win.innerHeight = 150;
         //now position the window like the google notebook window
         positionGUI();
      } else {
         ethsms_gui_win.close();
         ethsms_gui_win = null;
      }
   }
safiel
Posts: 16
Joined: April 10th, 2008, 6:11 pm

Post by safiel »

Yup, I've spent a bunch of time looking over what they are doing. A few extra things to note that make doing this more of a pain then it appears. The method you described only works on windows. window styles like alwaysRaised are not supported on the mac (or linux). However, it appears that on osx you can modify the zindex of the iframe and bring it up above the tab when you change tabs. I was hoping this method would work on both platforms, since this would also get around the issue that flash elements that are under your iframe popup will show through when they update. This means that if you want to do this everywhere you have to have two different implementations for things like loading/hiding/etc the modal.

In summary:
* Mac has a bug with flash elements showing through our iframe popups
* Mac os doesn't support certain window styles like alwaysRaised (not so much a bug as a support issue).
* Windows doesn't let us bring our iframe to the top

Trying to work around bugs is a paint.
ithinc
Posts: 1029
Joined: February 19th, 2008, 12:10 am

Post by ithinc »

@mark
Post feature requests to http://tabutils.uservoice.com.
Post bug reports to https://github.com/ithinc/tabutils/issues.
peter.kehl
Posts: 7
Joined: July 16th, 2008, 6:30 am
Location: Vancouver, Canada
Contact:

Re: Persist a xul iframe document after hiding/showing it

Post by peter.kehl »

It's years since your question. However, if anyone has a similar problem, try to Firefox's elements <tabbox>, <tabs>, <tab>, <tabpanels> and <tabpanel>.
Post Reply