Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Force 'new window' links to open in new tabs in Safari Web Browsers
After browsing for a few hours in Safari, it's possible to end up with a dozen windows or so because of links that open a new window (links with target="_blank"). I've always wished there was a way to have these links open in a new tab instead of a new window (sometimes referred to as single window mode).

In the latest Safari 3.1, Apple finally added a (hidden) preference to do just this! To enable single window mode, which forces all links that would normally open a new window appear in a new tab instead, we only need to enable the TargetedClicksCreateTabs preference using the following command (paste it into Terminal):
defaults write com.apple.Safari TargetedClicksCreateTabs -bool true
[robg adds: This worked for me, but note that it will create those new tabs in the foreground, not the background. Command-clicking the link, however, will open the page in a new tab in the background (this has always been true, as I recall). The preference setting is mostly useful for sites you haven't visited before -- with it set, you'll not have window proliferation if you just click instead of command-clicking. To undo the setting, you can just delete the preference: defaults delete com.apple.Safari TargetedClicksCreateTabs. Make sure Safari's not running before you use either command.]
    •    
  • Currently 2.77 / 5
  You rated: 1 / 5 (13 votes cast)
 
[89,294 views]  

Force 'new window' links to open in new tabs in Safari | 29 comments | Create New Account
Click here to return to the 'Force 'new window' links to open in new tabs in Safari' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Force 'new window' links to open in new tabs in Safari
Authored by: rmcmahan on Mar 26, '08 08:30:32AM

This "sort-of" worked for me. After running the command, I could click on a "new window" link but nothing would happen until I command-clicked. Then I got a new tab (in the background). I mistakenly thought that it would revert to normal if I just changed "true" to "false" but it didn't. I reapplied the command with "true" and then applied the command above to delete the preference but that did not change anything either. I still have to command-click on "new window" links. Hm-m-m. Maybe if I re-install safari 3.1...



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: michno on Mar 26, '08 08:33:51AM

There has to be some other way 'cause on my computer Safari opens links that would otherwise open in a new windows, in a new background tab. I've had it like this "forever" so I have no idea what command I used to get it this way.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: Spartacus on Mar 26, '08 08:42:15AM

SafariStand?



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: WadeHM on Mar 26, '08 09:02:28AM

On any link in Safari, Command Click opens a new tab in the foreground, Command Shift Click opens a new tab in the background. This has been around awhile, surprised no one uses it.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: tatilsever on Mar 27, '08 11:42:09AM

I click with the middle button of my mouse (the scroll ball on Mighty Mouse) to open links in a new tab in the background.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: Finn on Mar 26, '08 09:03:42AM

CMD + click or just drag a link from a web page on to the Safari tab bar to open a new tab.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: MacTipper on Mar 26, '08 10:22:33AM
Several people are saying that this already works for them in Safari. The way you probably got this behavior was by going to the "Tabs" pane of the Safari prefs and unchecking "Cmd-Click opens a link in a new tab".

The difference though, is that the links the tip works on are links that have target="about.blank" in them. So a link like this one forces Safari to open the link in a new window. But when you use this tip, this same link opens in a new tab.


As far as running the defaults delete... command, using true and false worked for me.

MacTipper
My Mac-Tipping Blog

[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: porkchop_d_clown on Mar 26, '08 11:13:24AM

Oh, thank you. That's one of the two behaviors that Firefox has that I miss in Safari.

Now, if I could re-open recently closed tabs....


---
Everyone loves a clown, but no one will lend him money!



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: deebster on Mar 26, '08 12:20:37PM
Force 'new window' links to open in new tabs in Safari
Authored by: macfreek57 on Mar 26, '08 11:41:59AM

Good news (for me, at least): it doesn't seem to work on new windows created by javascript (i.e. window.open()), so most advertisements and interface utility windows will still "pop up" rather than opening a new tab.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: ra5ul on Mar 28, '08 12:57:54PM

actually it does. it only allows resized popups, where "resized" means firefox's "browser.link.open_newwindow.restriction = 2".



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: marook on Mar 26, '08 05:32:28PM

Ahh, as this is in the GUI, it's not really hidden. It's been a GUI pref since they introduced Tabs.

Prefs: General:
Open links from other applications: in a new Tab in the current window.

That pref has worked for me always, as it seems to apply this to '_blank' links as well.

---
/Marook



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: zpjet on Mar 27, '08 06:21:34AM

no it doesn't. _blank windows open in a new one.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: mtchandler on Mar 26, '08 08:43:18PM

try safari stand plug in it really works



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: the_0ne on Mar 26, '08 08:46:57PM

Just wanted to share a problem I had with my mbp when running this command. I noticed "no" links that would open to a new window/tab worked anymore. I mean nothing, links just stopped working. I couldn't figure out why because my iMac at work took this command fine. And both machines are configured pretty similarly.

I figured out the problem through the apple support forums. Apparently I installed SafariStand back before the upgrade to Safari 3.1. I had to remove the SafariStand.bundle file from HD/Library/Application Support/ Simbl/Plugins. Restart Safari and voila, works now and the new setting for opening new windows in tabs works fine now also.

Now, I also read in the forums that you can just reinstall the latest SafariStand and that'll work fine also. However, the only reason I installed SafariStand to begin with was for this functionality, so I didn't re-install. But like I said, my work machine has SafariStand installed and it works fine with this new command. Maybe it was just an old version of SafariStand.

Good luck...



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: luhmann on Mar 26, '08 11:03:52PM

In Firefox I have the Google search box set to open search results in a new tab, but I don't know how to make Safari do this. In Safari 3 it seemed I could do this by holding down the "command" key, but since 3.1 I seem to have lost this functionality.



[ Reply to This | # ]
Command-click/Google Preferences
Authored by: drmacnut on Mar 27, '08 06:26:20PM
I think you'll find that Safari version 3.1 (build 5525.13) works fine for doing what you need, luhmann. Check your Safari prefs once again in the Tabs section.

Also, if for some reason you might want Google to open clicked results URLs in a new window by default, that is a Preference setting that is found with _Google_ itself. Go to www.google.com and click on the Preferences link to the right of the search box and you'll see a check box for "Open search results in a new browser window." Of course, that can always be overridden with a simple Command-click to open the result in a new _tab_ instead, as has been mentioned ad infinitum on this thread.

[ Reply to This | # ]
Let Your Fingers Do The Walking
Authored by: drmacnut on Mar 27, '08 06:16:58PM

Sorry to say it, folks, but all this futzing around with modifying prefs and using SafariStand or Saft or whatever just makes things worse in my opinion, especially as Safari sees regular code updates from Apple. As others have already mentioned (Robg, Finn, et al.), there is a much simpler solution: Command-click. Safariʻs prefs should be set so that Command-click opens the link in a new tab, and the option to have that tab be selected automatically or not is also available in the pref panel.

Of course, you can always just right-click (Control-click) and select "Open Link in New Tab". Activate the Status bar (View -> Show Status Bar) so you can see what result your actions will have as you mouse over the links.

Look at what Command-click does vs. Shift-Command-click vs. Option-Command-click. Surprise!

The way some of you approach these simple actions seems a bit like trying to use a rubber band connected to a velcro patch glued to your dashboard to turn the key in your carʻs ignition, rather than simply using your hand. Just sayinʻ.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: carfield on Mar 28, '08 11:34:54PM

If I click links at gmail, it will still popup a new windows....

May be this is not work for webkit?



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: macamanic on Mar 31, '08 10:33:23AM
Download "Secrets" for free. At the top of the page click on "PrefPane" and it will download into you system preferences. Open it, click "Safari" on the left pane and scroll down to "Single Window Mode". Check the box and restart safari when prompted.

http://secrets.textdriven.com/preferences/list


[ Reply to This | # ]
Middle-click
Authored by: thinkyhead on Apr 17, '08 01:14:55AM

If your mouse has a middle button or click-wheel, you can use it to open a link in a new tab. (This may not work if you've reassigned your middle button.)

---
|
| slur was here
|



[ Reply to This | # ]
Not working
Authored by: spectre51 on Apr 17, '08 09:01:37PM

I tried this and it still isn't working for me all my new window links still open in a new window. Why can't this be a preference....



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: mgshattuck89 on Jun 09, '09 08:21:45AM

I realize this is an older thread, but I just wanted to let everyone know this hint still holds true in Safari 4.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: hasseg on Sep 23, '09 11:33:37AM

This is not working for me on Snow Leopard (10.6.1) and Safari 4.0.3 but I've heard from someone with the same versions of Mac OS and Safari that it is indeed working for them. Does anyone know what the problem might be?



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: draft on Feb 09, '10 10:50:51AM

This solution does not work for me either (OS X v10.6.2 and Safari v4.0.4). Does anyone have a solution to this issue? I really want to get this working

Thanks,
David



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: cooker47 on May 27, '10 05:09:09AM

I replied to this a few days ago - not sure what happened to that - maybe it's case of "Note: New users' comments are held for human review to prevent comment spam."

I'm using Safari Version 4.0.5 (4531.22.7) on OSX 10.4.11 PPC.

My two workarounds are:

1) Applescript:

tell application "Safari"
     make new document with properties {URL:""}
end tell

2) Make a new bookmark in your tool bar and have it do Javascript s.t. like this:

javascript:function%20load()%20{var%20load%20=%20window.open('','','scrollbars=yes,menubar=yes,height=1024,width=1024,resizable=yes,toolbar=yes,location=yes,status=yes');}load()

Regards.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: petrafan on Jun 07, '10 07:14:40PM

anyone knows if this hint works with the new Safari 5?



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: MJCube on Jun 08, '10 09:30:43AM

This behavior is listed among the new features, so I think that means theyve added a GUI method and this hint would no longer be needed.



[ Reply to This | # ]
Force 'new window' links to open in new tabs in Safari
Authored by: petrafan on Jun 15, '10 09:54:09AM

i've found the solution.

Safari/Preferentes/Tabs --> Open pages in tabs instead of windows: choose Always.

thank you.



[ Reply to This | # ]