Greetings! Gmail is now a gadget container. This document will teach you how to write useful gadgets which run well and take full advantage of the gadget API.
This document assumes:
- You can post files to public Internet. If you do not have web hosting, then you can post gadgets with the Google Gadget Editor (GGE for short).
- You know a little about gadgets. If not, please see this excellent Getting Started guide for the gadgets.* API.
- The parent web page, which has an iframe on it that contains your gadget. In this document, Gmail is the container. Other examples would be iGoogle or Google Calendar.
- Content Type
- Gadgets come in 2 flavors,
type='url'. The default is
type='html', and it is strongly encouraged. Here is additional documentation.
- A web page, which runs in an iframe on the parent containers. (Note - this is a simplified definition.)
- Gadget Specification / Gadget Spec
- An XML file which contains the gadget metadata and display data. Here is the reference.
- Public Internet
- A web page which anyone on the Internet can access. An intranet or your local hard drive is not on the public Internet.
- A view is a location where a gadget is displayed. Gmail supports the
- The user who is logged into Gmail, and thus is viewing your gadget.
Developing your gadget
- Make a gadget spec. (Use the Hello World sample to get started.)
- Publish the gadget spec to a location which is accessible on the public Internet. An intranet will not work. Your hard drive will not work. (Why? The Google servers will download the gadget. If they can't reach it, then Gmail can't display it.)
- Load the Gmail 'Add any gadget by URL' lab feature. In Gmail, click on the 'beaker' icon in the top right corner to load the Labs page. Find the 'Add any gadget by URL' lab feature, and click 'Enable'. Finally, at the top or bottom of the page, click the 'Save Changes' button.
- Ask Gmail to load the gadget. Go to the 'Gadgets' tab of 'Settings', enter your gadget URL in the 'Add a gadget by its URL' box, and click the 'Add' button.
- After clicking 'Add', the gadget will appear in the left navigation of Gmail.
Publicizing your gadget
Publicizing the gadget uses almost the same method as developing it.
You can prompt a user to add your gadget by instructing them on how to enable the 'Add any gadget by URL' lab feature, and providing them with the URL for your gadget.
Gadget features that Gmail supports
Gmail supports many gadget features. Here are some of them:
|setprefs||Sets the value of a user preference programmatically. See Gadgets API Reference: Saving State for more information. Note: Gmail currently does not provide any UI for a user to modify the preferences.||
|dynamic-height||Gives a gadget the ability to resize itself. See Gadgets API Reference: Managing Gadget Height for more information.||
|settitle||Sets a gadget's title programmatically. See Gadgets API Reference: Setting a Gadget's Title for more information.||
|views||Allows specifying the location in a container where a gadget is displayed. See gadgets.* Developer's Guide: Creating a User Interface for more information. Note: Gmail currently only supports the
|opensocial-0.8||Allows access to social networking functions from within gadgets.||
|OAuth Authorization||Allows making authenticated requests to third-party services via