active browser window - Mozilla

This is a discussion on active browser window - Mozilla ; g'day all, I have an object running an interval-based task, which when triggered I would like to execute only and only if the browser window, in which the object responsible for the task is instantiated, is the active window on ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: active browser window

  1. active browser window

    g'day all,

    I have an object running an interval-based task, which when
    triggered I would like to execute only and only if the browser
    window, in which the object responsible for the task is
    instantiated, is the active window on the screen. How do I
    check that? Looked around in DOM window and nsIWindowMediator
    docs, but I do not seem to find anything suitable.

    Any help is greatly appreciated.

    Thanks in advance

    marco

  2. Re: active browser window

    marco.donizelli@gmail.com wrote:
    > g'day all,
    >
    > I have an object running an interval-based task, which when
    > triggered I would like to execute only and only if the browser
    > window, in which the object responsible for the task is
    > instantiated, is the active window on the screen. How do I
    > check that? Looked around in DOM window and nsIWindowMediator
    > docs, but I do not seem to find anything suitable.
    >


    Check the document.hasFocus property

  3. Re: active browser window

    thanks a lot Neil,

    1) document.hasFocus always return undefined for me (Firefox 2.0...)
    - doesn't come up either within Gecko DOM Document Reference:

    http://developer.mozilla.org/en/docs/DOM:document

    2) wouldn't that return true if and only if a focusable element
    in the document has actually got focus? so it would return
    false if I simply raise the browser window to the top with
    Alt + Tab?

    thks

    m

    2008/5/9 Neil Deakin :

    > marco.donizelli@gmail.com wrote:
    > > g'day all,
    > >
    > > I have an object running an interval-based task, which when
    > > triggered I would like to execute only and only if the browser
    > > window, in which the object responsible for the task is
    > > instantiated, is the active window on the screen. How do I
    > > check that? Looked around in DOM window and nsIWindowMediator
    > > docs, but I do not seem to find anything suitable.
    > >

    >
    > Check the document.hasFocus property
    > _______________________________________________
    > dev-extensions mailing list
    > dev-extensions@lists.mozilla.org
    > https://lists.mozilla.org/listinfo/dev-extensions
    >




    --

    Marco Donizelli
    Senior System Developer
    bMenu AS
    +47 41731128

+ Reply to Thread