How to set focus on a window in multi-tab windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • datactrl
    New Member
    • Jul 2008
    • 51

    How to set focus on a window in multi-tab windows

    On firefox multi-tab, I open a window with ref=window.open (). It works. A new window is opened in a new tab. On parent window, there is button doing ref.focus(). But it won't put focus on that new window. So how do I set focus on a window in a multi-tab hosting?

    Jack
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    The simple answer is you can't, but you can in browser-specific code, e.g. XUL, extensions, etc. - see https://developer.mozilla.org/en/Cod...Tabbed_browser

    Comment

    • datactrl
      New Member
      • Jul 2008
      • 51

      #3
      Thank you, acoder. After study the page mentioned, still have no idea about how to activate a specific tab on firefox. Do you have sample code about it? thank you very much!

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        The sample code is there. It's a case of using it in the correct context.

        Note that using this code would be Mozilla-specific making use of XUL. To get started, see https://developer.mozilla.org/en/XUL_Tutorial.

        Comment

        • datactrl
          New Member
          • Jul 2008
          • 51

          #5
          Thank you, acoder. I'm going to study that and have a try test.

          Comment

          • brandonmack
            New Member
            • Feb 2012
            • 1

            #6
            I actually had this same question - here's a solution I found (I know this thread is old, but I know it can be useful to others)

            I used:
            Code:
            ref=window.open().focus();
            This will not work with all browsers, at least not yet, but it certainly will work with some, and it's worth a try!

            Comment

            Working...