Fixing a small iPhone annoyance…

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:

Open in New Tab

Update: I’ve added a bookmarklet that does the exact opposite, in case you need an undo. (I needed an undo):
Open in Same Tab

For Example’s Sake:

Daring Fireball

Daring Fireball - Tabbified

del.icio.us:Fixing a small iPhone annoyance...digg:Fixing a small iPhone annoyance...

21 Comments

  1. Nate
    July 3, 2007
    9:18 pm
     

    I LOVE YOU

  2. B.P.
    July 7, 2007
    3:35 am
     

    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!

  3. Grateful
    July 12, 2007
    1:19 pm
     

    Thank you so much. I never thought to just run javascript on the page to fix this issue. Brilliant!!

  4. Nate Brown
    July 14, 2007
    9:41 pm
     

    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.

  5. Kinmar
    July 20, 2007
    7:36 am
     

    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.

  6. Chucho
    July 20, 2007
    4:49 pm
     

    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!!!!

  7. Chucho
    July 20, 2007
    4:54 pm
     

    Oops - there’s also a %3C that needs to be changed to

  8. TjL
    July 21, 2007
    4:32 pm
     

    I, also, love you. Thank you for this.

  9. T.
    July 24, 2007
    9:18 am
     

    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.

  10. ridogi
    September 14, 2007
    8:34 pm
     

    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.

  11. Kyle
    September 25, 2007
    6:36 am
     

    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!

  12. winson
    September 25, 2007
    7:50 pm
     

    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!!

  13. Steve
    September 29, 2007
    7:45 am
     

    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 =

  14. Steve
    September 29, 2007
    7:46 am
     

    (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) =

  15. Steve
    September 29, 2007
    7:48 am
     

    (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 “

  16. Steve
    September 29, 2007
    7:53 am
     

    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/

  17. Jeff
    November 8, 2007
    8:21 pm
     

    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?

  18. drirepooriucK
    November 27, 2007
    3:32 pm
     

    Hi, hello, privet
    animated

  19. 232
    November 30, 2007
    6:32 am
     

    U GENIUS! :)

  20. Ryankn
    January 26, 2008
    9:34 am
     

    Is there any way to add this bookmarklet through a website, just like the iTransmogrify bookmarklet?

  21. Amanda
    April 1, 2008
    4:51 pm
     

    MULTI-LINKS MOBILE STORE LIMITED

    ALL LISTED ITEMS ARE FOR SALES:

    Email: multi-links@hotmail.com

    NOKIA N96 for $370usd
    NOKIA N78 for $280usd
    SIDEKICK LX for $190usd
    SIDEKICK SLIDE for $170usd
    T-MOBILE WING for $200usd
    Sony Ericsson G900 for $250usd
    Sony Ericsson XPERIA X1 for $330usd
    8GB Apple iPhone for $290usd
    16GB Apple iPhone for $390usd
    SAMSUNG G810 for $270usd
    HTC TyTN II (Kaiser) for $400usd

    GSM Quad-band (850, 900, 1800, 1900 MHz)
    Wireless data
    Wi-Fi (802.11b/g)
    EDGE
    Bluetooth 2.0+EDR
    16GB flash drive
    Camera 2.0 megapixels
    3.5-inch (diagonal) widescreen multi-touch display
    480-by-320-pixel resolution at 160 dpi
    16GB APPLE IPHONE ITEM IN BOX:
    iPhone
    Stereo Headset
    Dock
    Dock Connector to USB Cable
    USB Power Adapter
    Documentation
    Cleaning/polishing cloth
    User guide
    Travel Charger
    Leather Case

    EMAIL US IF YOU ARE INTERESTED IN BUYING.
    CONTACT EMAIL: multi-links@hotmail.com

    We make shipment through Fedex Courier Service and its within 48hrs (2days) delivery worldwide.

    THANKS.

3 Trackbacks/Pingbacks

  1. […] 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. […] 2. Open links in new window Makes links appear in new windows when you tap on them. Read more here […]

  3. […] 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

Your email is never published nor shared. Required fields are marked *
*
*