Friday, 9 May 2008

There's no place like home, canvas

One of the features of the iGoogle sandbox is the notion of views, the ability to target content to different display areas. Views are supported across OpenSocial containers, but each container may support a different set of views. To help you re-use your gadgets, we've added a new views feature to the sandbox.

In the iGoogle sandbox, there are two views. The home view is the smaller of the two, comparable in size to iGoogle gadgets running outside of the sandbox. The canvas view presents a "full-screen" version of a gadget, filling all of the room available on the iGoogle page.

In other OpenSocial containers such as orkut, there are also multiple views. In orkut there is a profile view and a canvas view. The profile view is a similar size to the home view in iGoogle.

For some gadgets, it may be appropriate to display similar information on a user's orkut profile view as in a user's iGoogle home view, or across other views in OpenSocial containers. Previously, the solution to this problem was duplication of code, by creating two content sections, one for profile and one for home, both with the same content. Now, I'm happy to tell you that these views can be concatenated into one view by declaring view="home,profile" in a single content section.

This also means that gadgets that handle presentation logic for differently sized views in a single content section can extend that support to the canvas page by declaring view="home,canvas".

Details on concatenated views will soon appear in the section on views in the iGoogle Developer's Guide.