Reputation: 29870
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.
Upvotes: 3
Views: 3960
Reputation: 16508
You can achieve this with Scriptish's GM_openInTab
implementation, like so:
GM_openInTab(window.location.href, true);
That should cause the page that a GM script is on to be focused.
Upvotes: 1
Reputation: 5369
I'm pretty sure that firefox gives focus to tabs that call alert()
. So just pop up an
alert('found foo')
Upvotes: 3