Capture Google Results in a Google Box

Add a little box of Google results to any page in your web site.

A Google box is a small HTML snippet that shows Google search results for whatever you’re searching for. You might wish to display on your web page a box of pages similar to yours, pages that link to yours, or the top hits for a search that might be of interest to your readers.

Google boxes as a concept—the idea of taking a shortened version of Google results and integrating them into a web page or some other place—are not new. In fact, they’re on their way to becoming ubiquitous when it comes to weblog and content management software. The Google box is easy to implement and was one of the first examples of Google API usage. As such, it enjoys the position of proto-application: a lot of developers whip up a Google box just to see if they can. Do a Google search for Google Box to see some other examples of Google boxes for different languages and applications.

What goes in a Google box, anyway? Why would anybody want to integrate them into a web page?

It depends on the page. Putting a Google box that searches for your name onto a weblog provides a bit of an ego boost and can give a little more information about you without seeming like bragging (yeah, right). If you have a topic-specific page, set up a Google box that searches for the topic (the more specific, the better the results). And if you’ve got a general news-type page, consider adding a Google box for the news topic. Google ...

Get Google Hacks, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.