Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

OpenSocial Gadgets - Tutorial

Lars Vogel

Version 1.1

18.04.2011

Revision History
Revision 0.125.11.2009Lars Vogel
created
Revision 0.2 -1.128.11.2009Lars Vogel
bugfixes and updates

Open Social Gadgets

This article gives an overview about OpenSocial Gadgets.


Table of Contents

1. OpenSocial Gadgets
2. Hello OpenSocial Gadget
3. Thank you
4. Questions and Discussion
5. Links and Literature
5.1. Source Code

1. OpenSocial Gadgets

OpenSocial Gadgets are part of the Open Social initiative. OpenSocial Gadgets are web based UI components. A Gadget is defined via a XML file which contains a header with definitions of the Gadget and an embedded content payload. This payload is a combination of HTML and JavaScript which defines the gadgets look and behavior.

A very simple Gadget looks like this.

			
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
  <ModulePrefs title="Hello OpenSocial Gadgets!">
    <Require feature="opensocial-0.8" />
  </ModulePrefs>
  <Content type="html">
    <![CDATA[
      Hello, OpenSocial Gadgets!
    ]]>
  </Content>
</Module>
		

A Gadget has always the root tag <Module>. This root tag contains a <ModulePrefs> and a <Content> section. The ModulePrefs contains information which OpenSocial features are required by the module and information about the author. The content section contains the actual HTML and JavaScript.

A Gadget is hosted in a server infrastructure to provide its data. A web page that hosts gadgets is called an OpenSocial.

Most websites which work as a OpenSocial Container uses the Apache Shinding reference implementation.

For example the iGoogle , LinkedIn, MySpace, orkut, XING can host OpenSocial Gadgets. The only exception is Facebook; they have their own standard.

For detailed information you can read the latest released Open Social Specification .

Open Gadgets Gadgets are specified in OpenSocial Gadgets API Specification .