Shorten a URL on your iPhone With bit.ly Bookmarklet

While you can navigate to the bit.ly website and copy & paste your URL to be shortened, it is the long way of doing it and clunky.

Here at The iPhone App Blog, we found it too hard to be constantly attempting to copy and paste all the URLs that we wanted to shorten, so we have found a shortcut for you to create shortened, user-authenticated URLs:

1. First create a bookmark by tapping on the “+” at the bottom of your screen in safari and tapping on Save.

2. Copy the following text:

javascript:var%20d=document,w=window,enc=encodeURIComponent,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),s2=((s.toString()==”)?s:(‘%22’+enc(s)+’%22′)),f=’http://m.bit.ly/’,l=d.location,p=’?v=3&u=’+enc(l.href)%20+’&s=’+enc(d.title)+’%20’+s2,u=f+p;try{if(!/^(.*\.)?tumblrzzz[^.]*$/.test(l.host))throw(0);tstbklt();}catch(z){a%20=function(){if(!w.open(u))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();}void(0)

3. Open up you bookmarks and find the bookmark you just created, edit it. You can charge the the Title as you wish, we used “SHORTEN.” Then you are going to want to edit the URL. Tap on it, then tap on the ‘x’ to clear the area and paste the above code. Now just save everything & exit out of your bookmarks.

4. Give it a try! Navigate to a website, tap on the bookmarklet & viola! the URL will be shortened for you (Note: you might have to sign in at least once into bit.ly on your iPhone, if you have not done so in the past.)

Sources: The above code is an altered version of the code for the bookmarklet found here.

Author: Matt Sawyers

Share This Post On