How to hack a Google Gadget

Google gadgets are surprisingly simple. They consist of an XML file that contains the code for the gadget. The code is often just basic HTML, e.g. for a search form, or else may include some javascript for fancier effects.

I recently installed a Flickr search gadget. It works, but loads the resulting Flickr page in the same window as my iGoogle page. Not really what I wanted, since the idea is to launch things from iGoogle rather than going back and forth from it. The nice thing about the gadgets is that the source code is available. So I grabbed it from the above link, opened it up in emacs and changed all instances of the HTML <a> attribute “target=’_top’ ” to “target=’_blank’ “.

All well and good, but how to get the modified version onto iGoogle? You need a web server for that. Drop the modified XML file somewhere in your webserver documents directory, then find the link on an iGoogle “add stuff” page that says “Add by URL”. Paste in the URL to your gadget file, e.g.; and you’re all set. My Flickr search results now open in a new Firefox tab.

Update: I’ve tried a lot of “simple search form” gadgets today and so many of them suffer from this “load in same page” problem. And it’s so easy to fix. Can I plead with all gadget developers – use target=”_blank”.

6 thoughts on “How to hack a Google Gadget

  1. So, what I want to know, and this is rather beyond my capabilities, is would it be possible to use igoogle as a portable bioinformatics portal? i.e. have your Perl scripts set into google gadgets so that you can run your queries wherever?

  2. Interesting idea. Pierre has written a simple bioinformatics Google gadget to use the NCBI utilities. I’d like to see more of these – they would make great projects for bioinformatics students.

    I’m not sure how you’d incorporate Perl scripts. Presumably they would need to be kept on a server and you’d access them via xmlHttp requests from the gadget.

  3. Cool. I’m starting to envisage a crazy future of portal pages filled with bioinformatics gadgets.

    (have to point out that target=”_top” in the source that I looked at Eric ;) )

  4. Guys, what is bioinformatics gadget? Is it something similar to flickr search gadget? I am new at gadget things and looking forward to learn more about this..

  5. @tv bracket – a bioinformatics gadget is simply a gadget that accesses a bioinformatics web service. The examples mentioned above allow biologists to perform searches at the NCBI; for example, to retrieve biomedical literature or DNA sequences.

Comments are closed.