Force Firefox To Open Links In Same Tab
One of the great annoyances on the Internet are links that are configured to open in new links or tabs. Outbound links, which means links that point to another domain, are usually prime targets for this method of linking but there are also cases that links on the same domain open up in new tabs or windows. The Firefox web browser comes with a set of options to open links in new tabs or windows but no obvious ones to prevent that from happening.
To open a link in a new window or tab one would simply right-click the link and select the appropriate option from the context menu. Users who like keyboard shortcuts can press the Ctrl key for opening links in new tabs or the Shift key to open them in new windows. Alternatively, a middle-click on a link opens it in a new tab as well.
Thankfully though there is a parameter in the Firefox configuration that allows Firefox users to force the web browser to open links in the same tab unless one of the previously mentioned ways of opening links in new tabs or windows is selected.
Users who want to change this behavior need to type in about:config in a tab in the Firefox web browser. This should open the Firefox configuration. First time users need to accept a disclaimer. They then need to filter for the term browser.link.open_newwindow. The default value of that entry is 3 which opens links that would normally open in a new window in a new tab.
To force Firefox to open links (no matter if they have been designed to open in a new tab or window) in the same tab one would need to change the value to [1] which will open all links that would normally open in a new window in the same tab. Changing the value to [2] would open new windows in a new window (duh).
- Value of 1: Opens links that would normally open in a new tab or new window in the current tab or window
- Value of 2: Open links that would normally open in a new window, in a new window
- Value of 3: Open links that would normally open in a new window in a new tab in the current window (default)
Update:
Just noticed that changing the value to 1 does affect links that are opened in external applications as well. These links will now open in the active tab and not a new tab.
Update 2:
An anonymous commenter just mentioned that there is a new setting available under the preference browser.link.open_newwindow.override.external which defines how and where links from external sources are opened in Firefox. Its default value is set to -1 which makes Firefox use the browser.link.open_newwindow preference when it comes to determining how external links are opened in the browser. The preferences are the same and you can use the values you see above to modify the behavior for external links differently.
Advertisement
doesnt work!
in case some might appreciate, i had some help putting together a udf for opening hyperlinks by excel vb:
Sub goFHL(strF As String, strDL As String) ‘255 chars AS: goFHL ActiveCell.Formula, “,friendlyname”
‘split(x, y) syntax what, strDL what: x
Dim v As Variant ‘follow HYPERLINK AS: (left of friendly name): goFHL ActiveCell.Formula, “,IF(”
‘enter quotes as string ANS: either double up on quotes:
‘goFHL ActiveCell.Formula, “,””SAM””” ‘for: ,”SAM” OR USE: & CHR(34) &
‘goFHL ActiveCell.Formula, “,” & CHR(34) & “SAM” & CHR(34)
If InStr(1, strF, “HYPERLINK”) = 0 Or InStr(1, strF, strDL) = 0 Then
application.EnableEvents = True: Exit Sub ‘EVENTS
End If
v = split(strF, strDL) ‘split/rem? strDL from right?
On Error Resume Next
ActiveWorkbook.FollowHyperlink application.Evaluate(Replace(v(0), “HYPERLINK(“, “”)) ‘replace quotes with nothing?
application.EnableEvents = True ‘EVENTS
‘gofhl() GOFHL()
End Sub
Thanks a million, Martin!! I’ve been trying to find an add-on or extension – or SOMETHING – to do this for the longest time now. The way I needed my browser to operate while I’m at work is to have the main website that I use for everything – open all links in a new tab within the same window, for all links that I click while on that main site. In essence, everything from within that same domain would all be in the same window, as tabs. All the other websites that I use are either opened from a shortcut on my desktop or from Outlook, both of which are considered external links. I wanted those external links to open in a new window for each website I needed to access.
If anyone else is trying to accomplish the same type of browsing experience as myself, all I had to do was (like stated above) go to about:config and then scroll down to “browser.link.open_newwindow.override.external” and double click to open the change value screen. By default it will be set to -1 which you will delete and replace with 2. From that point on FF will function exactly like I’ve described.
Very nice article..it working perfectly…. Thanks lot
My problem is that any text dragged and dropped to a blank area of a page (tab) will attempt to open that text as a URL even though the text is not in URL format.
This is soooo annoying as a form page being filled by dragging text from another page is completely lost when the text is accidentally dropped outside of the input box.
The operator needs to start all over again after reloading the correct page…
Whats the point of a browser trying to open, for example “brian.com” just because the text “brian” was dropped onto a blank part of the page…. It would be ok if the text was a url like “www.brian.com” but a non url text format forcing the opening of a a url is just plain lunacy.
Ive set the following in hope that, when this happens, the non-url will open a new tab, preserving the current tab inputs… alas, no effect
browser.link.open_newwindow 3
browser.link.open_newwindow.override.external 3
browser.link.open_newwindow.restriction; 3
To no avail.
Any ideas on how to fix this stupid behavior would be greatly appreciated as it costs much frustration for our employees.
Almost 4 years on, Google sends me to here. Your post, your updates, and reader updates have removed my biggest paper cut.
Thanks.
Ken thanks for the compliment, glad you find the site useful.
FYI: http://kb.mozillazine.org/Browser.link.open_newwindow (written in October 2007)
I know this is an extremely old article, but for whatever it’s worth, I’d like to say that to open external links in a new tab in the same window – while opening all links in the same tab (with the exception of middle click etc.) one needs to change “browser.link.open_newwindow.override.external” to 3.
The default is set to -1, which annoyingly makes all external app links open in the same tab :O
I don’t know if somebody has already posted this, but maybe an update to this article would be nice :)
Done, thanks for pointing me towards it.
Thanks Valdis! That was what I was looking for!!!
To open links in the same window, but links from external program in the new tab, need to set:
browser.link.open_newwindow 1
browser.link.open_newwindow.override.external 3
I am using Firefox Nightly (64 bit) with Windows 7. From out of the blue when I try to refresh a tab it suddenly started opening a new tab. This is terribly annoying.
I followed your instructions after opening about:config and changing the setting from 3 to 1 but no change. Any other ideas?
Thanks a ton!!
Now that they have stopped development of prism, I have decided to try and use the ‘app tabs’ introduced in Firefox 8. Many of my apps run on several domains, and Firefox likes to open the links in new windows by default, defeating the purpose of having a tab pinned.
This did the trick for me, now my apps will stay inside their pinned windows. Thanks!
I use a tab groups and a sidebar that has parent and child tabs, and it would be nice if I could specify this behavior for only certain parents/children. I’d apply it to a couple of parent/child sets in the Group I use for work, but I’d want the default behavior to happen in the rest of my tabs.
Rockstar you are. This worked great. Many thanks
I can’t get this to work with FF5. I would like links to just open in the tab i’m using. If I need to see a page again then I’ll just use the history functions. Ideally I would like to have just one tab open for my whole session UNLESS I physically choose to open a particular link in a new tab or window. FF5 isn’t making this easy to achieve. Any assistance appreciated.
Thank you:)
I cannot get links to open in tabs with any settings. Have Tools/Options set to open all links in a new tab, but that doesn’t work. Have set config to 3 and that does not work either. Everything always opens in the same tab. I can manually open but right clicking the link and telling it to open in new tab, but what a pain. This was not like this yesterday or day before and I have not changed any settings. Has to be a FF issue! If anyone finds out what’s going on, please post. Thanks!
muzikween
It seems we are opposites – you don’t want links opening in the same tab but I do, If you find out why yours works the way it does I’d appreciate that info as it sounds like the situation I want to achieve. If I find out why mine seems to be misbehaving I’ll post again!!!
Try middle-clicking links.
oh man, thank you so much
thank you for the post.
thankyou man. you are a light of glory shinning through the internets darkness.
A big thank you for this tip which works perfectly.
Get Tab Mix Plus and go to the links menu. Select the dropdown option for Javascript pop-ups: Open all pop-ups in tabs.
Get Tab Mix Plus and go to the Links tab. Select the drop down option for Javascript pop-ups: Open all pop-ups in tabs.
These settings doesn’t seem to work for me :(. I am using Firefox 3.0.12. I want to open all Internal links in same tab i.e. if a local url is already open in a tab, just switch me over to that tab and refresh that page. This is useful when I am developing some web application and running it from Eclipse IDE. Is it really complex to achieve it in firefox, I guess Safari in Mac do it well
.
@Martin
Yes, the option to always open in a new tab is set. Clearly it doesn’t work. Maybe TabMix Plus interferes?
I’m not sure how to answer your question about navigation. Opening in a new tab seems most logical to me. If I want to open multiple links on a page (like when I am in a threaded forum), I will open a new window and then drag links into that window. That way I still maintain the original root. Maybe this works for me because I commonly keep a lot of tabs open and get back to them over time (I have 72 tabs open right now).
I agree with Paules. I want ANY link I click on to open in a new tab and I don’t want to hold down the Ctrl key to do so..
The settings you refer to in About:Config are both set to 3 in my system, so that SHOULD make everything open in a new tab, but it doesn’t.
For instance, from Google Reader, SOME entries will open directly in a new tab, while others will only open in new window, unless I right click and select open in a new tab. I’m curious as to what causes this to happen.
JoJo have you set the Always open new windows in tabs option in the Firefox options? I’m also curious how you handle navigating on the same site if all links open in a new tab, that seems mighty uncomfortable.
Thank Martin , it work fine in v.15 too.
You forgot to explain that you have the “restriction” entry to [0] to get rid of pop-ups :D
Thanks for the tip
thanks so much ^^
Nice tip, Martin. Thx!
With the worth of a thousand in mind this days i have to wright to you, thanks a mil. for your quick and very handy advice to me.
Nice hack :D
Yeah (duh) really nice Martin but what about links who are opening in the same tab? I really want all links the open in a new tab.
Paulus then press Ctrl while clicking on a link or do a middle-click on that link.
Here we are just entering 2022 and I find this whilst searching for help on this issue.
I used Spybot today and it cleared my Firefox setting – my fault because I forget to uncheck this in Spybot before running a scan/clean.
Now I have Firefox set to 2 as Martin explains, and yet links always open in current tab. The Ctrl click tip is great but why cannot I not have this as a default action as I had before my Spybot accident?