Monday, September 18, 2006

One day with Google Gadgets

I came across the Google Gadgets API today (I know that is an old news already!). Google Gadgets API lets you write gadgets (referred to by Yahoo as widgets) or mini-applications that can run on a Google Personalized web page, Google Desktop or Google Pages (http://pages.google.com).

Here is the URL of Google Gadgets API: http://www.google.com/apis/homepage/index.html. As the overview page says, with basic knowledge of HTML and Javascript you can get upto speed wihin minutes with developing your first Google Gadget! Follow the steps given in the developer guide to build a simple gadget (it is a simple XML file), upload it on google pages or google base or any public web server and you are raring to go.

Try one simple gadget I developed (? :-)) to start with:

1. Go to www.google.com
2. Go to the Personalized Home
3. Click on the "Add more to this page" link at the top left hand corner
4. Click on the "Add by URL" link, next to the "Search Homepage Content"
5. Enter the URL http://arati.rahalkar.googlepages.com/myfirsttimegadget.xml
6. A dialog box saying "You are about to add a feature that was not created by Google. Do you wish to continue?" will appear. Choose OK.
7. The gadget will get added to your personalized Google home page displaying the current time and a greeting depending on the time of the day.
8. You can change some of the preferences by clicking on the "edit" button. This will show the preferences in a pop-up. Specify your name, the date-time format and the background color and click Save. See the preferences being applied to your gadget.
9. The next time you visit your Personalized Google home page, don't miss my first time gadget :-)

Pretty cool for starters huh?

One of the things I was searching for is to be able to embed these google gadgets in web pages other than just the Google pages. I tried embedding my gadget on my Google pages home page (you have to enable experimental features in Google Pages settings in order to embed standard / third-party gadgets). Check out my google pages home page at: http://arati.rahalkar.googlepages.com/.

However, I had to follow a very crude approach to embed this gadget on a web page. Viewed the source of my Google pages home page, and copy-pasted the div section that contained the gadget. It worked, but without the "Edit Preferences" option, as you can see below:



One of the nice things about Google gadgets which I have not really trid it out on the first day is that you can write AJAX-enabled gadgets. So you can have gadgets that fetch data from the server asynchronously and show you latest updated information.

As with all the other Web2.0 things and AJAX enabled toolkits, Goolge gadgets is not the only one in market. There are Yahoo widgets which have been around for a longer time, cannot compare the two since I haven't checked it out still.

On a side note: With AJAX and Web 2.0 coming so strong, I think good knowledge of Javascript is definitely going to be one of the skills a programmer needs to have. Cannot keep running away from Javascript code anymore!

No comments: