6 Replies Latest reply on Dec 5, 2008 9:13 PM by PierreBerlin

    Setting systemChrome when using window.open()

    PierreBerlin
      Hello,

      Is that possible to set systemChrome to none somehow when opening a new window with window.open();?

      Thanks for reading!
        • 1. Re: Setting systemChrome when using window.open()
          kstephens2
          Use windowOptions.systemChrome = air.NativeWindowSystemChrome.NONE

          Example:

          var windowOptions = new air.NativeWindowInitOptions()
          windowOptions.systemChrome = air.NativeWindowSystemChrome.NONE
          //Create the window
          var htmlLoader = air.HTMLLoader.createRootWindow(false,windowOptions, false)
          • 2. Re: Setting systemChrome when using window.open()
            PierreBerlin Level 1
            Yeah, i know that, but i am somehow not able to build a sandboxBridge between those two windows when using HTMLLoaders createRootWindow.. i only managed that with window.open, but i need to build up an Bridge between both windows and must be able to set the systemChrome, but i'm not able to manage that :-/
            • 3. Re: Setting systemChrome when using window.open()
              PierreBerlin Level 1
              I just have read this in http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f08. html :

              "If you use the HTMLLoader class createRootWindow() function to create a window, the new window is not a child of the document from which createRootWindow() is called. Thus, you cannot create a sandbox bridge from the calling window to non-application content loaded into the new window. Instead, you must use load an intermediate page in the new window that itself uses frames to load the child document. You can then establish the bridge from the parent document of the new window to the child document loaded into the frame."


              Is there really no way in an html/js-AIR Application to "communicate" between the window, that calls createRootWindow(); and the one that gets opened? Is it in any way possible to create a multi window app using HTMLLoader? or another way? Or will i be not able to create a fine multiple window app that way?
              • 4. Re: Setting systemChrome when using window.open()
                kstephens2 Level 1
                I ran into those issues too and I am not claiming my way is good, but what we did was to hide an app window that opens several objects, one of which was a windows object. This custom window object makes windows, keeps track of them and puts a reference to the parent object into every window created so I can reference back via it. So now any window can call the window object and get a reference to another window and call methods inside of it or change DOM in another window.

                It is convoluted at best, but it works.
                • 5. Setting systemChrome when using window.open()
                  Joe ... Ward Level 4
                  You can create a chromeless window with window.open(), but it takes a little ActionScript since you have to extend the HTMLHost class and you just can't do that in JavaScript. (There's an example of how to do this here: http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7e74. html.)

                  When using createRootWindow(), you can have the parent window set a reference to itself after creating the child window (as long as the root content of both windows is from the same domain):
                  var childHTMLObject = air.HTMLLoader.createRootWindow(false,windowOptions, false)
                  childHTMLObject.window.parent = window;

                  Or you can set any other reference you need this way to allow the child to communicate. You could also have the parent listen for events generated by the child, which is, perhaps, a more flexible way to communicate. So yes, you CAN create multi-window apps with JavaScript and HTML.

                  Communicating between application and non-application content is another issue. Unfortunately, you can't create a sandbox bridge directly between the "parent" and the new window created with createRootWindow(), but there is a workaround, which is described in the docs you cite.

                  To use a sandboxBridge in this case, your new window has to load an HTML page from your application that contains a frame or iframe. The root content of this window will be in the application sandbox and can communicate with other application windows. The frame is in a security sandbox based on its domain of origin. You create a sandbox bridge between the root content of the child window and the frame content to allow communication between the application and the non-application content.

                  @kstephens Having a window manager object in a complex app doesn't strike me as particularly convoluted, but note that you can create the normal HTML properties like parent and opener even when AIR doesn't do it for you automatically.
                  • 6. Re: Setting systemChrome when using window.open()
                    PierreBerlin Level 1
                    WOW, thats alot of input, thank you very much! I'll check all that, when i'm continuing my work on monday. A real blast getting that much of help, thank you very much! I'll mark messages as answer as soon i'm done.