问题
Is the a way to programmatically open a URL in a new tab in firefox without firefox gaining focus?
What I found out so far:
firefox -new-window <URL>lets ff stay in the background, but opens a new window instead of a tab.firefox -new-tab <URL>opens <URL> in a new tab but gives focus to ff.
EDIT: What I'm trying to accomplish is making the feed reader plugin in claws mail open stuff in firefox in the background, so that I can go through my feeds and open everything that interests me and actually read all the stuff after that. Oh and I should probably mention that a linux/gnome-only solution would be fine, too.
回答1:
If you set browser.tabs.loadDivertedInBackground to true in about:config then -new-tab will open tabs in the background and not focus the window. This does more than you (or I) want but perhaps it is a suitable work-around for you?
回答2:
I believe you can set your firefox to open new tabs in the background. If you programatically open a new tab it might open it in the background. If anything it might be worth trying.
回答3:
You found the new tab parameter, so you're just missing the focus thing.
That ought to be window manager-dependent I think. Isn't something firefox itself is responsible for. If there's a pointy clicky tool to tune the way metacity does that then I'm unaware of it.
来源:https://stackoverflow.com/questions/498530/open-a-new-tab-in-firefox-and-keep-ff-in-the-background