Monday, April 4, 2011 at 8:48 AM
The iGoogle Gadget Directory just got better. Users can now interact with a gadget in the directory before adding it to their page. Have a look at a couple examples like the Google News or Google Hot Trends gadgets.Your gadgets can have live previews too. Gadgets that use Content view="default" already have a live preview in the gadget directory. Remember, view="default" can match any view supported by the container. Similarly, if the Content element in a gadget doesn't specify the view attribute, that's treated the same as if view="default" were present. Up until now, the only views that were supported on iGoogle were home and canvas; remember, home is the smaller version and canvas is the larger version.
Some gadgets are customized to display differently for the home and canvas views. If your gadgets do this, you can update the gadget XML spec to add a unique view for the preview or reuse an existing content element.
For gadgets with an element <Content view="home,canvas">
In this case you can just add preview, so you'll have view="home,canvas,preview".
For gadgets with <Content view="home">
Here too, you can reuse the home view for the preview by changing your spec to view="home,preview".
There are some other restrictions on the way the preview works. A preview can't use OpenSocial calls - since the user hasn't set the OpenSocial permissions before installing the gadget. You may want to address this in your gadget by making a special preview version that uses some dummy data, or you can opt out of the live preview and stick with a static screenshot.
Like all gadget views, the preview is cached. This reduces load and speeds up serving for users. But if you're working on your gadget and don't see a recent change in the preview, you can disable caching temporarily by adding the parameter "nocache=1" to the url.
Gadgets displayed as a preview also can't navigate to other views using requestNavigateTo(). If your gadget has a link that triggers changing the view it won't work in the preview.
If you feel a preview isn't the right choice for your gadget then specify the other views (home & canvas) and be sure that your screenshot does a good job of conveying what your gadget will do for users.
As always, come to the iGoogle Developer Forum to talk about live gadget previews with other iGoogle developers.