I wasn’t sure it could be done, but I’ve done it. I’m happy to say that I’ve made it even easier to use the LongURL web service, specifically on your own site. Today I wrote a jQuery plugin that allows you to add LongURL support to a website in like, I don’t know, 30 seconds?! It really depends on how fast you are, but the point is that it’s really easy.

I noticed that Twitter search lets you expand URLs from some of the most popular shortening services (though, if they used LongURL they could support a whole lot more ;-) ). I liked their UI approach; it’s clear, simple, and effective. So I pretty much mimicked their UI for my plugin.

So here it is, you can add support for LongURL to your site in just a few lines of code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript" src="http://longurl.org/static/jquery.longurl.js"></script>
<script type="text/javascript">
$(function() {

Yup, that’s it. Also, if you don’t like the Ajax working indicator that I chose, you can use your own like so:

$(function() {
    $('a').longurl({working_image: 'http://example.com/images/ajaxy_animation.gif'});

So, that’s how you use the plugin. You can see a demo of it in action, and download it from the jQuery site. Hope you find it useful.