Javascript – Activate Firefox tab in Greasemonkey/Javascript? Is this possible


I developed a greasemonkey script that refreshes a page and checks for certain updates. I would like to run this script in a tab and browse the internet in another tab, but then have the script automatically activate it's tab when an update is found.

Im not sure how clear that was, maybe this is better:

Tab 1 is running a greasemonkey script, refreshing every x seconds looking for the word "foo"

Tab 2 is browsing stackoverflow

— Now on a refresh, the GM script finds the word "foo". This is when I want the tab focus to automatically shift from Tab 2 to Tab 1.

Is this possible, and if so, how do I achieve this?


Best Solution

I'm pretty sure that firefox gives focus to tabs that call alert(). So just pop up an
alert('found foo')

Related Question