Mac: Making Safari open links in a tab

I've mentioned before that I really like Safari as my default browser, mainly because it's lightning fast, even more so with version 3.1. One of my pet peeves with it is the way it handles opening links that are targeted for a new window.

Links on a web page either go within the current browser window (or tab) or can be targeted to a window - the author of the page determines the target. Web sites will often target a new window because they don't want the user to leave their site. While this is all fine, I personally can't stand having a ton of browser windows open. The tabbed interface model for browsers is perfect for me - I like to open new browser windows as tabs and then be able to quickly switch between them.

There's a setting in Safari that allows you to open any link on a page in a new tab instead of a new browser window. Under Safari / Preferences / Tabs you can select the option that Command-Click opens any link in a new tab. I can also use my Logitech's scroll wheel button (Mouse Button 3) to perform that action.

The problem in Safari is that if the target for a link is a new window, Safari opened it in a new browser window. Man this drove me nuts until tonight.

Jon Sabino dropped in a comment on my last post mentioning an article on The Unofficial Apple Weblog about how to fix this problem. It's as simple as opening a terminal window and pasting in the following line:

defaults write com.apple.Safari TargetedClicksCreateTabs -bool true

Shut down Safari and restart it and off you go! From now on clicks that would normally open a whole new browser window will instead be targeted in a new tab in your current Safari window. 

Thanks for the great tip Jon!

Comments

Sean said…
It's a good thing to know. Thanks for the tip!
Unknown said…
Thanks for the tip, I've always wondered that too.

I've never actually gotten myself to switch from Firefox to Safari but the more people preach Safari, the more I find myself going to it every time my Firefox crashes or hangs up (which is often). The thing that bugs me the most: switching tabs.

Does anyone know how to switch to a different tab if it's not the next one?

I know that Cmd + { or } will take you to the next or previous tab, but lets say I'm on tab 4 and I want to switch to switch to tab 1. In firefox you just press Cmd + 1, but in Safari that just opens your first bookmark. I hate having to move my hand to the mouse just to switch tabs, or mash a key 9 times just to get back to a different tab. Anyone?
David Alison said…
@aaron: You can move between tabs (provided you are not in a text input box) using Command-Shift Right or Left. It does cycle around so the worst case is you would have to go through half of your tabs.

I don't know of any other way. A quick Google search yielded nothing. Anybody else?
Anonymous said…
Hi all! Wonderful blog David, and happy to read your Mac experience :)

Unfortunately no new tab tips, but thanks to a Google search I discovered an interesting file:

file:///Applications/Safari.app/Contents/Resources/Shortcuts.html

Hope you'll have fun with it :)
Unknown said…
It has been interesting following you blog. From a new to Mac user to offering terminal command line tips. Time: less than two months!
g7whatever said…
I was just listening to macbreak weekly a podcast about all things mac and one safari tip that they pointed out is a site that points you to plugins similar to firefox called pimpmysafari.
Anonymous said…
It worked! Thanks for posting!
Andrew said…
Thanks - this worked so easily. A big problem resolved in seconds, that is so rare!
Anonymous said…
Brilliant tip!
Anonymous said…
Nice, it also works in Safari 4.0 Beta :)!
Anonymous said…
perfect!!! now i can get rid of mozilla once and for all1!!
I have been looking for this solution for 2 years.
Why doesn't safari give you this option?
henasraf said…
Any chance to figure out how to do the same for Safari on Windows?
iescience said…
Thank you for solving the last remaining problem I've had with using Safari. I may return to it as default, now (instead of Camino). A blessing on your head, David Alison!
Jay said…
OMG, New Mac user for just a week and it was really bugging me. Didn't even know where terminal was, found it easy (gotta love Mac), pasted in that line, and problem solved!! Thanks SO MUCH!!!
Unknown said…
Thank you so much for the tip. Works great in 4.0.
Anonymous said…
I found this via another forum, and it's good to know. I was using Safari Stand, but with Snow Leopard, Stand isn't working at the moment. That's all I really needed it for anyway, so this change is perfect. Don't know why Apple can't make it an option in preferences.
alexantha said…
not working for me, *&%(*&^) safari is still opening links in windows. of course you can't find any HELP with this from safari. i am using safari 4.0.3 with os 10.5.8. this is making me nuts! i keep using safari when firefox freezes up (frequently), but i truly hate this feature. it is ignoring the preference!
Naomi said…
thank you so much!
Adrien said…
awesome tip! was about to abandon safari for firefox
Miruna said…
For me it does not work as well...tried it several time.
Safari 4.0.5 :(( Very unhappy!
Julie said…
I'm using Safari Version 4.0.3 on OSX 10.6.2 and this worked GREAT! Awesome work, thank you so much for this :)
Anonymous said…
Safari 5.05 offers a solution to this. In preferences->Tabs> Open pages tabs instead of windows->choose tabs
Safari 5.1, OS 10.6. Didn't work. Sigh.

Popular posts from this blog

Keyboard vs. Mouse

Some cool Firefox add-ons

A hardcore Windows guy gets a Mac