views:

1295

answers:

4

Hello,

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?

Thanks.

+1  A: 

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

Ovesh
A: 

Thanks a lot Ovesh, it does change the focus! However, I don't want the alert there :( Can I automatically close it?

Logan Serman
not as far as I know.
Ovesh
A: 

Have you looked at GM_openInTab()?

Kent Brewster
A: 

very powerful and critical