Tag Archives: lilurl

lilURL Bookmarklet

0
Filed under ain't that nifty
Tagged as , , , , , ,

lilURL is a free URL shortening web app. It’s used by a number of sites, including ur1.ca, which was set up by the founder of identi.ca for use with that service. One of the problems with lilURL compared to other url shortening services is that it only accepts POST submissions, meaning that a simple bookmarklet like javascript:location.href="http://ur1.ca/?longurl="+document.URL won’t work.

Instead, you have to create an invisible form and submit it, like so:
javascript:myForm=document.createElement("form");myForm.style.display="none";myForm.method="post";myForm.action="http://ur1.ca/";myInput=document.createElement("input");myInput.setAttribute("name","longurl");myInput.setAttribute("value",document.URL);myForm.appendChild(myInput);document.body.appendChild(myForm);myForm.submit();document.body.removeChild(myForm); The above will work for any lilURL service; just change the address in myForm.action="http://ur1.ca/"; to the address of the lilURL service.

Finally, here’s the bookmarklet for ur1.ca: Shorten w/ ur1.ca.