<a href=”http://www.mattcutts.com/blog/” target=”_blank”>Matt Cutts</a>
Go on, try it on this link: Matt Cutts
If you wanted to create a bookmarklet to open a new window or tab, you’d do it like this:
so the actual bookmarklet link that would appear in your HTML as
and if you want to play with it, here’s the trivial CNN example bookmarklet. On Firefox, you can drag the bookmarklet to your bookmarks bar. On Internet Explorer, you can right-click and select “Add to Favorites…”.
The reason I mention this is that bit.ly is a url shortening service that I like, and they have a bookmarklet, but it replaces the page that you’re shortening. Their bookmarklet looks like this:
So suppose you find a new page that you want to twitter about or shorten the url for some reason. You want a bookmarklet that opens the bit.ly url in a new window or tab instead of replacing the current page. Combining the two bookmarkets, you’d get
and here is a bookmarklet for bit.ly that opens your bit.ly url in a new window or tab. You can just drag the bookmarklet to your bookmarks folder.
I want to open a new tab, not a new window!
Some webmasters want to choose between a link opening a new tab vs. a new window. I believe that you don’t get that choice — it’s up to the user and their web browser. For example, in Firefox a user can select their desired behavior under Tools → Options → Tabs → “New pages should be opened in:” and choose “a new tab”. Or to tweak the setting directly, the user can type “about:config” into the location bar/address bar and then modify the “browser.link.open_newwindow” option to be one of the following values:
1 = open new windows in the existing window
2 = open new windows in a new window
3 = open new windows in a new tab (this is the default in Firefox 2 and Firefox 3)
See this about:config page for more info.
Likewise in Internet Explorer, the user can go into Tools → Internet Options → “Settings” button in the Tabs section and then under “When a pop-up is encountered:” choose “Always open pop-ups in a new tab”.