Force Firefox To Open Links In Same Tab

Martin Brinkmann
Jul 3, 2009
Updated • Jul 25, 2012
Firefox
|
44

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

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Anonymous said on April 10, 2024 at 5:43 pm
    Reply

    doesnt work!

  2. dave's not here said on February 11, 2017 at 1:32 pm
    Reply

    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

  3. Bill M said on June 22, 2015 at 7:31 am
    Reply

    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.

  4. Mohan said on April 15, 2015 at 10:17 pm
    Reply

    Very nice article..it working perfectly…. Thanks lot

  5. Lem said on October 24, 2014 at 3:03 pm
    Reply

    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.

  6. Ken said on April 6, 2013 at 8:53 pm
    Reply

    Almost 4 years on, Google sends me to here. Your post, your updates, and reader updates have removed my biggest paper cut.
    Thanks.

    1. Martin Brinkmann said on April 7, 2013 at 3:22 am
      Reply

      Ken thanks for the compliment, glad you find the site useful.

  7. Webster said on October 30, 2012 at 9:40 pm
    Reply
  8. Just a nobody said on July 25, 2012 at 6:46 pm
    Reply

    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 :)

    1. Martin Brinkmann said on July 25, 2012 at 7:05 pm
      Reply

      Done, thanks for pointing me towards it.

  9. Shelli said on June 13, 2012 at 6:55 pm
    Reply

    Thanks Valdis! That was what I was looking for!!!

  10. Valdis said on May 17, 2012 at 8:41 pm
    Reply

    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

  11. mick said on May 9, 2012 at 3:17 am
    Reply

    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?

  12. Darryl Meganoski said on November 27, 2011 at 7:15 pm
    Reply

    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!

  13. Kate said on October 7, 2011 at 4:25 am
    Reply

    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.

  14. Schalk said on August 13, 2011 at 3:30 pm
    Reply

    Rockstar you are. This worked great. Many thanks

  15. dmac said on July 10, 2011 at 8:32 am
    Reply

    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.

  16. App-o-holic said on May 30, 2011 at 6:42 pm
    Reply

    Thank you:)

  17. muzikween said on March 18, 2011 at 5:15 pm
    Reply

    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!

    1. dmac said on August 8, 2011 at 12:15 pm
      Reply

      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!!!

    2. Martin Brinkmann said on March 18, 2011 at 5:54 pm
      Reply

      Try middle-clicking links.

  18. sam said on March 18, 2011 at 1:47 am
    Reply

    oh man, thank you so much

  19. salahuddin66 said on March 23, 2010 at 9:02 pm
    Reply

    thank you for the post.

  20. matt said on March 22, 2010 at 11:36 pm
    Reply

    thankyou man. you are a light of glory shinning through the internets darkness.

  21. alumley said on February 25, 2010 at 7:49 pm
    Reply

    A big thank you for this tip which works perfectly.

  22. Ray said on August 18, 2009 at 7:52 pm
    Reply

    Get Tab Mix Plus and go to the links menu. Select the dropdown option for Javascript pop-ups: Open all pop-ups in tabs.

  23. Ray said on August 18, 2009 at 7:39 pm
    Reply

    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.

  24. Chetan Sachdev said on July 30, 2009 at 11:49 pm
    Reply

    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
    .

  25. Jojo said on July 4, 2009 at 9:59 pm
    Reply

    @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).

  26. Jojo said on July 4, 2009 at 10:54 am
    Reply

    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.

    1. Martin said on July 4, 2009 at 11:00 am
      Reply

      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.

  27. hwsris said on July 4, 2009 at 5:05 am
    Reply

    Thank Martin , it work fine in v.15 too.

  28. wako said on July 3, 2009 at 2:26 pm
    Reply

    You forgot to explain that you have the “restriction” entry to [0] to get rid of pop-ups :D
    Thanks for the tip

    1. greg said on January 19, 2012 at 5:28 pm
      Reply

      thanks so much ^^

  29. Nosh said on July 3, 2009 at 1:34 pm
    Reply

    Nice tip, Martin. Thx!

  30. paulus said on July 3, 2009 at 1:34 pm
    Reply

    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.

  31. Phaoloo said on July 3, 2009 at 12:53 pm
    Reply

    Nice hack :D

  32. paulus said on July 3, 2009 at 12:28 pm
    Reply

    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.

    1. Martin said on July 3, 2009 at 1:15 pm
      Reply

      Paulus then press Ctrl while clicking on a link or do a middle-click on that link.

      1. Paul Newman said on January 1, 2022 at 4:39 pm
        Reply

        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?

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.