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.
Here's how to use it:
- 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.
- Type some text in the textarea.
- Select the part you'd like to turn into a link.
- Activate the bookmarklet. This will bring up a search pane on the right side of your browser window.
The search query defaults to the text you'd highlighted. You can edit the query if necessary.
- 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.
I've been told that the bookmarklet works in Opera, but not in Safari. I'll look into the Safari issue.