Chickenfoot for Firefox: Rewrite the Web

User Interface Design Group

Library: google-ajax-search.js

The Google Search API is well-documented, but there are two important caveats when using the Chickenfoot wrapper for the API:
  1. The wrapper uses fetch(), so currently, it only works on MS Windows.*
  2. This library requires that you have a Google AJAX Search API license key, which you can get for free from http://code.google.com/apis/ajaxsearch/. Once you have a key, the simplest way to use it with the wrapper is to go to about:config in Firefox, create a string preference named google.GoogleAjaxSearchLicenseKey, and use your API key as its value. Alternatively, you can redefine getGoogleAjaxSearchLicenseKey() in the library. See the source code for more details.
Assuming you have your license key in place, here is a simple sample that uses the API in Chickenfoot:
// import the library
include("google-ajax-search.js");

with (window) {
  // create the search control
  var searchControl = new GSearchControl();
  searchControl.addSearcher(new GwebSearch());
  
  // create a place to insert the search control in the page
  var div = document.createElement("DIV");
  document.body.appendChild(div);
  
  // render the search control
  searchControl.draw(div);
}

Again, the official documentation contains a number of examples to demonstrate how to take full advantage of the API.

*For the determined Mac and Linxu hackers, this wrapper could likely be made to work on those OSes using whenLoaded(), though that would make the library slightly less convenient to use since it would have to use callback functions. We are working to improve Chickenfoot so that whenLoaded() is not necessary on those platforms.



©2004-2006 Massachusetts Institute of Technology