Call function on tab loading new page? - Mozilla

This is a discussion on Call function on tab loading new page? - Mozilla ; I was wondering if it would be possible to call a function I wrote when ever the browser changes to a new page (new page, tab, or just refresh). I tried using the "onload" event but that's just for the ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Call function on tab loading new page?

  1. Call function on tab loading new page?

    I was wondering if it would be possible to call a function I wrote when
    ever the browser changes to a new page (new page, tab, or just refresh).
    I tried using the "onload" event but that's just for the main window
    in the browser.

    What I hope to achieve is collect information as the user is surfing so
    that I know what buttons to enable and disable in the sidebar I created.

    What I have done for now as a workaround is use the setInterval()
    function to continuously call my function but it's causing problems when
    new features I am trying to add to my extension.

    TIA

  2. Re: Call function on tab loading new page?

    On Mar 13, 6:07 pm, Kevin Herrera wrote:
    > I was wondering if it would be possible to call a function I wrote when
    > ever the browser changes to a new page (new page, tab, or just refresh).
    > I tried using the "onload" event but that's just for the main window
    > in the browser.
    >
    > What I hope to achieve is collect information as the user is surfing so
    > that I know what buttons to enable and disable in the sidebar I created.
    >
    > What I have done for now as a workaround is use the setInterval()
    > function to continuously call my function but it's causing problems when
    > new features I am trying to add to my extension.
    >
    > TIA


    Have a look at the Tab event listeners at:
    http://developer.mozilla.org/en/docs...Tabbed_browser
    and also on webProgressListener at: http://developer.mozilla.org/en/docs...ogressListener

    Using these listeners you can avoid your polling scheme of
    setInterval()

    HTH

  3. Re: Call function on tab loading new page?

    stony_dreams wrote:
    > On Mar 13, 6:07 pm, Kevin Herrera wrote:
    >> I was wondering if it would be possible to call a function I wrote when
    >> ever the browser changes to a new page (new page, tab, or just refresh).
    >> I tried using the "onload" event but that's just for the main window
    >> in the browser.
    >>
    >> What I hope to achieve is collect information as the user is surfing so
    >> that I know what buttons to enable and disable in the sidebar I created.
    >>
    >> What I have done for now as a workaround is use the setInterval()
    >> function to continuously call my function but it's causing problems when
    >> new features I am trying to add to my extension.
    >>
    >> TIA

    >
    > Have a look at the Tab event listeners at:
    > http://developer.mozilla.org/en/docs...Tabbed_browser
    > and also on webProgressListener at: http://developer.mozilla.org/en/docs...ogressListener
    >
    > Using these listeners you can avoid your polling scheme of
    > setInterval()
    >
    > HTH


    Thank you very much! I'm going to read through it and see if I can get
    my code working without setInterval().

    Thanks again

+ Reply to Thread