After experiencing and thoroughly enjoying the iPhone for the weekend, I’ve found that one of my biggest gripes is that there’s no “Open in New Tab” command, which makes all the sense in the world since there is no right click anywhere in the OS.
Still, one of my favorite hobbies is to peruse Daring Fireball for the latest in Apple news, and open each linked article in a new tab behind my active tab so I can finish reading the site. It got to be too tedious to do this with iPhone, since every time I clicked on an outside link, it took me completely out of the site, and completely out of the experience.
So I took it upon myself to jerry-rig up a solution. I’ve created a small bookmarklet that grabs all links in a page, and forces them to… um, open in a new window. Wait! Don’t throw that tomato at me yet! Normally this would be absolute madness to unleash this upon the web, but iPhone in its infinite simplicity treats target=”blank” as a trigger to open a new tab. Tiny annoyance solved!
The easiest way to do this is to open safari, and drag the bookmarklet (linked below) to your bookmarks bar. Then just sync to your iPhone. Now you can trigger new tabs to your heart’s content.
Imagine that, a useful application of target=”blank”. Watch out for flying pigs.
New Tab Bookmarklet:
Update: I’ve added a bookmarklet that does the exact opposite, in case you need an undo. (I needed an undo):

For Example’s Sake:







26 Comments
I LOVE YOU
Thank you! This is one of the most useful scripts I’ve seen for the iPhone.
I thought of a idea that might make the script slightly more useful. Is there any way to open a link in a new page without taking you to that new page immediately (so that page can load in the background while you are still reading the original page)?
Thanks again!
Thank you so much. I never thought to just run javascript on the page to fix this issue. Brilliant!!
Thank you! I love the idea and appreciate your work. The open in new tab works great for me, but the open in same tab doesn’t work. I wonder if I’m doing something wrong or what. When I press the open in new tab, the little graphic pops up to links. When I press the open in same tab, the graphics disappear only 1 at a time. Any help is appreciated.
Any idea why I cant for the life of me get this bookmarklet to work on my iphone? it works in the browser but when I sync with safari and try it on the phone nothing happens? Any help is much appreciated.
It wouldn’t work for me either until I manually edited the url on the iphone. The transfer process had replaced the “unsafe” characters (braces, brackets, and spaces) with their special encodings. To do this you must bring up the bookmarks in landscape mode (otherwise the keyboard won’t show braces, brackets, or space keys when you edit the url). Then go through and change all strings as follows: %20 or %2520 to a space, %7B to {, %7D to }, %5B to [, and %5D to ]. Then it worked for me. Great bookmarklet! Thanks!!!!
Oops - there’s also a %3C that needs to be changed to
I, also, love you. Thank you for this.
Perfect!
Too bad the iPhone doesn’t have cut and paste. I don’t want to wait until I get home to add this to my Bookmarks!
I was even willing to manually type it in to have this now… but the iPhone doesn’t appear to have {}’s.
You can save this to your iPhone without syncing by putting http:// in front of the javascript to fool safari into thinking it’s a link. Then mail it to yourself, click the link, bookmark it and edit http:// out of the bookmark.
If you don’t want to use Safari to avoid the Bookmarks Bar and Bookmarks Menu folders in your bookmarks and you’re using Windows, you can sync from Internet Explorer. However, you have to make a small change to get the code to work.
Replace the %20 in the bookmark with just a space and the bookmarklet will work properly.
For example,
var%20a=document.getElementsByTagName(’a');
becomes
var a=document.getElementsByTagName(’a');
Do this for all the %20 in the bookmark and you’ll be good to go.
If you don’t, then when you sync it to the iPhone (or the Touch in my case), it will replace %20 with %2520. %25 is the code for ‘%’, so it parses everything and converts it to the proper code automagically
Hope this helps someone!
Hi,
It looks cool!! How can I add bookmarklet to my iPhone? While I click bookmarklet link in iPhone’s Safari, it shows me a dialog and never be added to iPhone!!
So I needed a bit more help from the web despite the above, very helpful comments. So for all who are trying this who are not as good with special characters, here is what to replace with what that finally worked for me:
%20 = space
%5B = [
%5D = ]
%7B = {
%7D = }
%2520 = space
%253C =
(Interesting. This happened on a post above me as well, when someone tried to explain how to replace the “%25 3C” symbol. Apparently that code stops your post. So to continue…)
%25_3C (without the underscore) =
(OK so now I’m really confused. Apparently it’s not the “%25 3C that kills these comment posts, but the symbol that you need to substitute. So here it is one last time:)
%253C = (the “less than” sign)
Unfortunately this all has to be done on the phone itself, which is not the most useful interface for this kind of editing, but it is possible! Took me three tries to get it just right. Essentially, the iPhone sees %20 in the actual address, and decides to replace the actual “percent” sign with the CODE for a percent sign, which is “%25″. So “%2520″ is the iPhone’s way of saying “percent-sign 20″, which is a space. That really confused me on %253C, because on all the sites I found, that’s not a code. But then I saw that “%25″ means “percent sign”, so it’s actually saying “percent sign 3C” which is the symbol “
My full post should read like this. Webmasters, sorry for the multiple reposts, but you can delete the above posts by me:
So I needed a bit more help from the web despite the above, very helpful comments. So for all who are trying this who are not as good with special characters, here is what to replace with what that finally worked for me:
%20 = space
%5B = [
%5D = ]
%7B = {
%7D = }
%2520 = space
%253C = (the ‘less-than’ sign)
Unfortunately this all has to be done on the phone itself, which is not the most useful interface for this kind of editing, but it is possible! Took me three tries to get it just right. Essentially, the iPhone sees %20 in the actual address, and decides to replace the actual “percent” sign with the CODE for a percent sign, which is “%25″. So “%2520″ is the iPhone’s way of saying “percent-sign 20″, which is a space. That really confused me on %253C, because on all the sites I found, that’s not a code. But then I saw that “%25″ means “percent sign”, so it’s actually saying “percent sign 3C” which is the symbol for ‘less-than’.
For those who need a list of symbols as I did, I found it here: http://www.the-art-of-web.com/javascript/escape/
Hi,
I was able to transfer the bookmarlet to my iphone (1.1.1) using itunes 7.4.3 on windows.
However, it continues to copy over the url-encoded brackets and spaces, even if i edit them on the mobileSafari itself, it won’t save.
Any suggestions?
U GENIUS!
Is there any way to add this bookmarklet through a website, just like the iTransmogrify bookmarklet?
Richard,
Sorry to be a semantics dink, but rather than jerry-rig, you may want to use jury-rig. The difference is evident in this link:
http://www.wsu.edu/~brians/errors/jerry.html
Thanks for the good tip!!!
e.
Richard, you are the greatest. I use this bookmarklet all the time. You are a genius!
i just got an iphone and this was the FIRST annoyance that made me think twice about the phone’s capabilities. problem wonderfully solved.
you rock.
Not my solution, but I found it on macrumours and it seems to work completely correctly.
http://forums.macrumors.com/showthread.php?t=325800
Post #9 by gr8tphan is absolutely accurate:
“I may have figured out a better way. If you touch and hold a link, a bubble displaying the URL appears. If you release right away, the bubble closes. But if you touch a bit longer, the bubble remains - lift your finger and tap near the bubble, and the link will open in a new window. It worked from macworld and tuaw, which *may* be mobile safari biased.”
It works everywhere I’ve tried it.
Thank you so much. There should be an award or something for this kind of stuff
CHEERS!
GENIUS. Terrific solution. Bravo!
I here the newcomer. Not absolutely I will understand with topic. Explain, please. http://kopitop.ru/map.html
3 Trackbacks/Pingbacks
[…] Originally Posted by mdc google maps and youtube links will open in the youtube and google map iPhone applications. Does anyone know if it’s possible to open a link in a new safari window? That was one of my minor gripes, so I coded up a small workaround. […]
[…] 2. Open links in new window Makes links appear in new windows when you tap on them. Read more here […]
[…] opens in a new window. The lack of a contextual click won’t stop you though. Just use this bookmarklet. Click on it whenever you’re in a page that has links you want to open as […]
Post a Comment