Saturday, March 10, 2007

Easier Links with Google AJAX Search API

Ever get annoyed by the complexity of adding links in blog or message board posts? Sure, it isn't rocket science, but between getting the angle brackets, quotes and start and end tags balanced correctly and getting the URL right, adding links is a pain.

This weekend I did some playing around with the Google AJAX Search API and made a nifty bookmarklet for creating links in textareas. I've only tested it with Firefox (various combinations of 1.5 and 2.0 on Linux, Windows and Mac), and it only works with plain old multi-line textareas (not 1-line text fields or rich/"wysiwyg" text controls). Aside from those caveats, it seems to work pretty well.

Installation is easy: just drag this link to your bookmark toolbar: [linkify] Note that if you're reading this in a feed reader you'll probably need to visit my site for this step, as feed readers usually strip out JavaScript. (Readlings: no smirking.)

Here's how to use it:

  1. Go to some page that has a textarea. The comments area on most blogs should work. The Blogger posting form in "Edit Html" mode also works.
  2. Type some text in the textarea.
  3. Select the part you'd like to turn into a link.
  4. Activate the bookmarklet. This will bring up a search pane on the right side of your browser window.

    screen shot

    The search query defaults to the text you'd highlighted. You can edit the query if necessary.

  5. Click on "create link" next to the search result. The popup will disappear, and the text you selected earlier (in the textarea) will be replaced with a link. The link's text will be the original selected text, and its href will be the URL of the search result you picked.

Thanks to Chris Wetherell for telling me about inter-frame communication with URL fragments, which turned out to be handy.

Update

I've been told that the bookmarklet works in Opera, but not in Safari. I'll look into the Safari issue.

posted Saturday, March 10, 2007
smart use of the AJAX api. Saves a lot of time posting blog entries.  
  Anonymous Anonymous on March 19, 2007
This is awesome - absolutely love it. The only suggestion I have is that it could use an option to make target="_blank". But other than that I think it's too great for words.  
  Blogger Steve on March 24, 2007
I just found your 'marklet at googlesystem.blogspot and, as I said there, dandy idea! Thing is, as you'll see in that post, a couple of us get only a no text selected error.

good hunting and TIA  
  Blogger Ben on March 24, 2007
Ok, it works fine. I walked through your example and succeeded right here in the comment box.
*scratches head*
*shrug*

Thanks for this.

RFE: can you point your engine at BlogSearch?  
  Blogger Ben on March 24, 2007
That's a really awesome tool. I've been looking for something like it for years. Thank you!  
  Blogger Chris on March 30, 2007
I would like to thank you for a great and useful tool.
Thanks again, we need more often tools that drive performance and productivity.
thanks again.  
  Anonymous Elias Kai on March 31, 2007
I tried this on Safari editing a Wikipedia textarea, and it didn't work for me. It kept saying I needed to select text first... but I did! :)  
  Anonymous Anonymous on March 31, 2007
As a new blogger, this tips might be very useful for me..thanks..:)  
  Anonymous dxblogger on July 18, 2007
thank you very much to expose this wonderfull trick!  
  Anonymous cartomanzia amore on November 02, 2007
thank you, this app saved me a lot of time posting  
  Anonymous tarocchi on November 09, 2007
I love you! Thank you for making this fab tool available! What an elegant solution. Bravo!  
  Blogger Suzanne on December 28, 2007
Cool application. I used it to make a link back to the place I found out about it, a post on linkify on ProBlogger.net

How cool is that?  
  Anonymous Mike Goad on December 28, 2007
I just wanted to test out your Linkify bookmarklet.

Social Bookmarking

Andrew  
  Blogger Andrew on December 28, 2007
Phenomenal Laurence!

Thanks a ton. I've ben searching for a way to speed the linking process. You nailed it.

Best to you in '08.
Mark Alan Effinger
RichContent.com  
  Blogger eAgent on December 31, 2007
Really nice piece of software. Thanks a lot.  
  Anonymous Fotografo on January 01, 2008
It would be exceptionally great if you could pick your engines... outside of that - fabulous tool. Thanks!  
  Blogger Miche on January 10, 2008
very useful. i was looking for something like this. thanks to problogger who brought me to this page. i will try in my blog http://great-blog-widgets.blogspot.com/  
  Blogger indhp money on March 22, 2008
I am just now testing out this tool (had read about it in Darren Rowse's blog).

I am testing it to see what it does.

Thanks!

Pat  
  Anonymous Pat Graham-Block on July 24, 2008
useful tip!!  
  Anonymous Photographer on May 12, 2009
This seems smart

Let me test it here cool!

just need to stop noscript blocking it now :-)  
  Blogger Mildly Interesting on May 27, 2009
This is great! Thanks, Brilliant!  
  Anonymous baskar on July 12, 2009
Just testing. LastFM is the best music ap out there. Wow! Great job.  
  Anonymous Anonymous on November 24, 2009
Read about this in MacLife - thanks a bunch for this tool really cool! Will be helpful in my blog posts on Simply Supply Chain  
  Blogger Doug Ingram on May 14, 2010
just a test ya know
sahwheet  
  Anonymous Anonymous on May 28, 2010
The best bookmarklet ever!
Thank you.

l3utterfish  
  Blogger l3utterfish on June 02, 2011