How To Stop Firefox From Stealing Window Focus

Prevent Firefox from opening when you're doing other things

Firefox turned 5 this week. While no other browser to date has been able to lure me away from Firefox since its first early beta, it does have its flaws and frustrations.
One of the most annoying habits Firefox has is stealing the focus from other programs you are working in. Clicking on a hyperlink inside programs such as email or office type applications causes the link you clicked on to automatically open inside Firefox. For example, I'm reading email, and I click on a link inside the email. All of a sudden I'm looking at a Firefox window showing the web page that the email link goes to.

There are a couple of fixes for this annoyance – some Firefox add-ons such as Tab Mix Plus will allow you to change how windows open. I prefer not to use an add-on if I don't need to and in this case you can prevent focus being stolen by editing the about:config file.
It's easy to do and completely reversible (though you need to know what you are doing). Here's how to edit the about:config file so no new windows open up when you click a link in another application.

First, type (or copy and paste) "about:config" (minus quotes) into the Firefox address bar and hit enter.


 

The next thing you'll see is a window telling you this might void your warranty (a little humor there, Firefox doesn't have a warranty).
 

 

Click the "I'll be careful, I Promise!" button. The about:config page will open.
In the Filter bar, type (or copy and paste) "browser.tabs.loadDivertedInBackground" minus the quotes. You will then see an entry under Preference Name that matches what you typed in.
 


 

 By default, the value of this entry is false. To change it, double click the entry and it will toggle so that the value reads true. Restart Firefox and you're done.

If you need to undo the change, right click on the entry, choose Reset and restart Firefox. This changes the entry back to its default setting. You can reset any entry that's been changed in the about:config page the same way. If you scroll down, you'll see some entries in bold. Those are entries that have been changed already, either by setting preferences (in the Tools/Options menu) or by an add-on. Right clicking any entry in bold and choosing Reset will cause it to revert to the default entry.
   
Changing entries in the about:config page can cause Firefox to behave oddly or not work at all. This isn't a good area to experiment with unless you'd like to uninstall and then do a clean reinstall of Firefox.

More information on the about:config entries can be found in this article at the MozillaZine Knowledgebase:
About:config entries - MozillaZine Knowledge Base

If you hose your Firefox installation, the Complete Mozilla Firefox Troubleshooting Guide can help.

 

Signing off for now,
Rhiannon

Click here for more items like this. Better still, get Rhiannon's latest tasty tech treats delivered daily via your RSS feeder or alternatively, have the RSS feed sent as email direct to your in-box.

 

Share this
4.09524
Average: 4.1 (21 votes)
Your rating: None

Comments

by dixie44 on 1. June 2013 - 2:47  (108188)

I hate to be a stealer of threads myself, but in my case it's Chrome. I love it but ever since going to Win 8, the same things occur except it immediately jumps in front of anything I am doing. And worse, if I move the mouse too far away after clicking to type, the page disappears, move the mouse back and it appears again. Sounds a but spooky but all I feel is really angry since it messes up my work and my play. Back to your regular channel. :-)

by rhiannon on 1. June 2013 - 3:04  (108192)

Oh I understand that sort of frustration. :)
This article at ghacks Chrome's experimental flags are now accessible via direct links - is a good look at some of the not-so-accessible Chrome settings, but I'm not seeing any options that would change the current behavior.

Anyone have any suggestions or tips?

by aklux (not verified) on 16. October 2012 - 11:20  (100838)

This focus stealing issue is a well known problem in Firefox (https://bugs.launchpad.net/ubuntu/+source/ubufox/+bug/272171)

So far, I've been working around this by setting "Focus Stealing Prevention" to "High" in "Special Window Settings", but this had the side effect that occasionnally dialog boxes would pop under firefox, making them hard to see.

Your browser.tabs.loadDivertedInBackground does indeed prevent the problem (even with "Focus Stealing Prevention" back to "Normal"), thanks very much, but it has another side effect: Formerly, when clicking on a link in thunderbird, it will highlight the firefox in which the link was opened in my WindowList widget, and with the loadDivertedInBackground, this is no longer the case. O well...

Btw, this focus stealing bug is known to Firefox, and the subject of numerous bug reports.

by Anonymous_Coward_433455 (not verified) on 16. January 2012 - 17:02  (87251)

i get firefox stealing focus for no reason at all as i'm working with Opera. there are no open tabs in FF that should cause this that i'm aware of and then i check that config setting and i already had it set to "true". hmmmm. would like this to stop already. i thought maybe i didn't have Opera fully maximized and was accidentally clicking my mouse on FF at the edge of the screen but that's not it. :(

by rhiannon on 17. January 2012 - 5:23  (87283)

@Anonymous_Coward_433455;
One other thing you might try is to go into Firefox Options and under Tabs add a check mark in the entry next to "open new windows in a new tab instead".
You might also check what browser is set as your default (Start/Default Programs).
I have Firefox set as my default browser and the settings I have, it doesn't steal focus when I'm working in any of the other browsers on my system.

by eleven11 on 28. November 2011 - 17:12  (84056)

This fix did not work for me, but perhaps I applied it thinking I was having the same problem as the author. I *do* think the issue is "steal focus" but I would describe it differently.

Windows XP Pro, two monitor setup which has worked without issue for over a year. Still works, with the following quirk: Suppose I am sending an email and I wish to attach pix which I am selecting from Windows Explorer (not Internet Explorer) on the left side and my email front end on the right side. I have a few other windows opn on the right side, in the background. The email front end is on top of any open windows on the right. When I click on the left screen, the right screen (apparently) reverts to whichever window it thinks is "most important"...but in any event, the desired target window goes away so there is no place to drag & drop the pic to. UNLESS, of course, my target window (the email front end in this case) is the "most important" window but there is no way (that I know of) to achieve that or to know in advance whether it is or is not....>>THAT<< being able to "pin" a particular window would solve the problem as far as I'm concerned. Yet I have never had to do anything like this. Got something going on the right hand screen? Go to the left screen? why should anything I do on the left influence what I am doing or what I am seeing on the right?

Or, if I have a piece of stock tracking software running in a window on the right and Excel on the left side, when I click anywhere on Excel, the stock-tracking window goes away and reverts to some other window which (I guess) must be "more important". And by the way, it appears to work the other way (excel on right, stock-screener on left, or....WDOs Explorer on right, email on left.)

Frustrating and non-productive. It never did this in the year or more I've been using the same hardware. Dumb 5-year old hp desktop. I recently replaced my hard drive. I know I updated FF some months ago but this problem is much newer than "months ago"...it just started to occur about a week or so ago! It's quite the PITA.

by eleven11 on 29. November 2011 - 6:51  (84085)

I fixed the problem I was having with the focus-theft. Uninstall Firefox, reinstall Firefox. Done. No tweaks (so far) to about:config. It's working just as it unpacked itself on the reinstall.

Ooops, I spoke too soon. The uninstall-reinstall worked as far as the email software (combo of gmail-right and Windows Explorer-left....to select and attach pix) but as far as the stock software (freestockcharts.com-right excel-left) nope.

Bleh.

by rhiannon on 29. November 2011 - 6:56  (84086)

@eleven11; That was a good move. I've gotten rid of gremlins in software that way. That and rebooting. =)

by rhiannon on 28. November 2011 - 18:51  (84060)

@eleven11;
I see what you are talking about now.
You might want to take a look at the Best Free Window Manager/Resizer/Arranger List category here on the site.
There's likely something there that will help. =)

by This problem is back in FF 8 (not verified) on 24. November 2011 - 21:07  (83847)

This problem is back in Firefox 8 and this About:Config option doesn't work anymore... :(

by rhiannon on 25. November 2011 - 3:50  (83854)

It's working fine in my Firefox 8.0.1.....you might try going in to the Options menu and under the Tabs section make sure that the box next to "Open new windows in a new tab instead" has a check mark next to it. =)

by Gggirlgeek (not verified) on 10. October 2011 - 7:07  (81178)

I too like to open lots of tabs in the background for later reading. Tabmix Plus fixes it. But that's not the problem for me now...

When I'm watching a TV show in full screen with Adobe Flash Player (such as Youtube) and I have another instance of Firefox open (for my TV calendar) it steals the focus of my main browser and minimizes the full screen, interrupting my show. It doesn't do this if the other Firefox profile is closed.

(Don't ask about the multiple profiles. Long story short, it's how I avoid being tracked by sites such as Gmail, Amazon and Facebook.)

I will try the solution above and report back once fixed.

by vick360 (not verified) on 27. October 2011 - 22:48  (82269)

I leave my firefox open with Google reader as a pinned app. I leave it minimized when doing other tasks. When watching fullscreen video/movies firefox would un-minimize itself and break my fullscreen video. It does this whenever the webpage decides to auto-refresh itself.

by rhiannon on 27. October 2011 - 22:49  (82270)

@vick360;
That's a great solution, thanks for posting it. :-)

by rhiannon on 10. October 2011 - 21:27  (81204)

@Gggirlgeek; I get multiple profiles, very useful. :-)

I haven't had any trouble with the focus when I use the method outlined, but I'm guessing if you have it set in both profiles it will work since that kind of info is stored in the .ini file for each profile.
Let us know if it worked. :-)

by Anonymous on 11. March 2010 - 20:25  (45398)

How to click a Microsoft Outlook email link, and have Firefox open in the background - rather than Firefox stealing my focus away from Outlook?

I want to click hyperlinks as I read through a newsletter email, but continue reading the email - while waiting for the links to load in Firefox, in the background.

IMO this is a much more efficient way of managing information - read the whole email, then go to the websites selected for further information.

Somebody said click the links after reading the email, but in long newsletters this would be a real timewaster.

by rhiannon on 11. March 2010 - 21:53  (45400)

The steps in the article should allow links to open in Firefox in the background. Outlook should stay as the focus.
I don't use Outlook but it works with Eudora and Thunderbird - it also works using FeedDemon news reader.

by Anonymous on 17. March 2010 - 2:41  (45695)

The steps in the article did not work - browser.tabs.loadDivertedInBackground is set to True in about:config, and still Firefox takes focus when clicking a hyperlink from Outlook, Word, RSSOwl, WinUtilities, etc.

I installed the Tab Mix Plus, and it DOES WORK, but it also does slow down Firefox.

You have to change the Tab Mix Plus Options under Links to "New tab" (both the first two settings) and also uncheck the box under Events, Tab Focus, Diverted windows.

Ideally you will have a Firefox window already open, ready and waiting, once you start clicking on hyperlinks. If not, then the first click will open Firefox and give it focus for this first time only. Once Firefox is open, clicking hyperlinks from Outlook and Word will open in a new tab in Firefox without taking focus away.

I really prefer not to use Tabs, so that each Firefox window will display in the task bar. But for the sake of this distracting Focus problem, it may be worth giving up the task bar view and using Tabs instead.

by rhiannon on 17. March 2010 - 3:09  (45697)

Thanks for the comments. I don't use Outlook so had no way to test it.
I've been using Super Tab Mode with good results. I just ran across Tab Utilities which I'm going to try. Tab Mix Plus is ok but it's really overkill for what I need.
Under Tools/Options/Tabs open new windows in a new tab instead unchecked? Just an idea.

by Anonymous on 4. April 2010 - 23:22  (46979)

Yes, very good you point out - the Firefox Tools/Options/Tabs "Open new windows in a new tab instead" is a critical setting for Tabs use.

I had troubles with this setting "sticking" while testing various Tab add-ons and a couple of Firefox updates, so sometimes you may have to go back and reset it.

For people who dislike Tabs, but also dislike Firefox stealing focus (this isn't just a visual interruption; Firefox also kills the mouse while it loads), I found this solution to be the least painful compromise:

Install "Tree Style Tab" add-on and set it to
1. show tabs at bottom of Firefox window,
2. "New window opened from links in webpages unexpectedly", open as tab
3. "open new tab instead of window"

Then install "ColorfulTabs" add-on, and set
*"Highlight the currently selected tab"

So now with these colored tabs at the bottom of Firefox, there is visual similarity for those of us who liked seeing the Firefox windows in the taskbar, while getting the advantage that only the first Firefox window takes total control of the interface.

by Anonymous on 14. January 2010 - 16:13  (41018)

I often have lots of open tabs in Firefox. When I exit Firefox, for example when a reboot is required, I want to continue working directly after the boot, no matter if the work is reading email, typing in OpenOffice or UltraEdit, sketching in Sketchup, Photo editing in Gimp or Paintshop and so on. That's no problem as long as I do not start Firefox after the reboot. If I do, FF starts reloading all my open tabs (as it should) and steals the focus of my front program after each and every page reload.

Yes the load diverted in background trick does work. But... I often send myself a lot of bookmarks from other computers. If I load these diverted in background, then I have to click though all my open tabs to find them back, time consuming and it disturbs the last seen sequence of my tabs.

by Anonymous on 30. November 2009 - 1:37  (37534)

Works well Rhiannon. Thank you for telling me how to solve another annoyance.

Cheers,
Mark

by Anonymous on 28. November 2009 - 19:55  (37480)

This is very confusing, what do you want to happen when you click on a link in your e-mail program???

by rhiannon on 29. November 2009 - 3:26  (37493)

I want the link to open in the background of Firefox and not jerk the focus away from what I'm doing by suddenly opening a window.

If I'm reading RSS feeds in my newsreader, I want to be able to click on the links and have them open in the background so I can keep reading the RSS feeds.

If I'm reading a document in Word I want to click on the link and have it open in Firefox in the background.
When I'm inside Firefox, I always have links open in background tabs so I can finish reading the page I'm on.

@Anonymous: Finish reading the email then click the link. Problem solved.
No, the problem is not solved.
Think of this scenario: You are sitting in front of a monitor. The monitor is showing an email program open, 5 or 6 Firefox "windows" with at least a half a dozen "tabs" open in each Firefox window.
Add another browser, like Chrome.
Add an open and running word processor, such as Word for Windows, and/or a text editor.
Add an open and running RSS feedreader.
Add an explorer type file management program, in this case xplorer2.
That is the normal state of my desktop.
When I'm working in one program and come across a link and click it, I don't want to all of sudden be looking at a browser window. I want to stay in the program I'm using and finish working and then go to the link.
I don't want to keep clicking from browser to program, back and forth, over and over.
When you visit as many sites in a day as I do (that would be so I can find interesting stuff to write about and post here) constantly clicking back and forth becomes a burden.
This is what works (and works very well thank you) for me.

by Anonymous on 20. November 2009 - 17:49  (36994)

Ok, now that I have done this, I get YAHOO POP-UPS where I did not have them before!

by rhiannon on 20. November 2009 - 19:34  (37004)

If that's the case, then I would undo the change (right click on the entry, choose Reset and restart Firefox)and run a virus scan. Check the options you have set for pop-up's in Firefox's menu bar: Tools/Options/Content and make sure the box next to "Block pop-up windows" is checked.

Changing the setting as outlined in the article wouldn't cause pop ups to appear. The only thing that this change does is make a Firefox window open in the background when you click on a link from inside other programs like email or newsreaders.

If you made any other changes to your system such as downloading and installing programs, using torrents, or visiting sites that have drive by malware then that could be the source of your problems.

by Anonymous on 19. November 2009 - 7:47  (36889)

I have an even better way. After several bouts with this problem I canned FF. If I have to install more crap to fix yet even more crap, I don't want the crap in the first place. And in any case, I don't want ANY crap that thinks it owns my machines.

by rhiannon on 19. November 2009 - 19:30  (36924)

I'd be interested in knowing what you are using now that works for you.

by Anonymous on 18. November 2009 - 3:27  (36814)

Good Day Rhiannon,

Great info!!

Thank You Very Much,
Best Regards,
Roberta

by rhiannon on 18. November 2009 - 4:02  (36819)

Hi Roberta, good to see you again. = )
I'm happy you liked the article.

Gizmo's Freeware is Recruiting!

Gizmos Needs YouShare your knowledge of free software with millions of Gizmo's readers by joining our editing team.  Details here.