Including the OpenSocial Feature JavaScript Libraries
There is a series of JavaScript-based features available in the gadgets JavaScript specification to help you build out your application. The functionality these features offer ranges from embedding Flash movies to creating simple tabs.
These JavaScript features include those that are built for server
communication (e.g., content-rewrite)
as well as for client communication (e.g., dynamic-height). This means that your gadget can
use these features to communicate directly with the hosting server and to
create client-based functionality.
As shown in the following example, you can include a specific
feature by adding a Require element in the
gadget XML spec file. Once initialized, the feature may be rendered via spec-defined JavaScript
initialization calls that you include in a Content section:
<ModulePrefs>
<Require feature="tabs" />
</ModulePrefs>A number of JavaScript features are currently available through the gadgets spec; these are listed in Table 4-1.
Table 4-1. JavaScript features
Attribute | Description |
|---|---|
| Gives a gadget the ability to resize itself automatically. This is useful if you’re inserting or replacing content via AJAX requests and the height of your gadget changes. |
| Embeds a .swf Flash movie in your gadget. |
| Displays within your gadget a small message window, which can be dismissed by the user. |
| Allows you to programmatically save key/value pair state information for a user. |
| Allows ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access