Force Safari to open targeted links in a new tab, instead of a new window

There is one feature in Firefox that I’ve always wished Safari had. The ability to always force targeted links (those that would normally open a new browser window) to open a new tab.

For example, if you’re viewing this in Safari and you click this link, it will open a new browser window taking you to Google. I would rather it open in a new tab instead. You can temporarily do this on a link-by-link basis by holding down the Command key when clicking the link, but I want it to work that way all the time.

Fortunately, this feature is already built into Safari (at least on the Mac), but it’s turned off by default. In order to turn it on, all you need to do is paste the following command in to the Terminal (quit Safari first):

defaults write TargetedClicksCreateTabs -bool true

That’s it. Safari should now open all links that would have opened a new window, in a new tab instead. If you want to turn this feature off, paste the same command, but replace the word “true” with “false”.

Thank you Roger Johansson!