type=url workaround for social api functions

Information

Summary

Until type=url is formally supported in orkut social gadgets, the following workaround will allow calling google.people.requestData from a third party website. Be aware that this method introduces considerable latency to the social calls and should not be mistaken for a production-ready library

Versions

Setting up

Requirements

You will need the following files:

You will also need to be using Firefox, with Firebug installed and enabled

Steps

  1. Open typeurl.core.js and change the typeurl.settings.BASE_REMOTE_URL setting to reflect the server and subdirectory where you will be hosting your gadget.
  2. If you wish to change the name of remote.html, then adjust the typeurl.settings.REMOTE_FILE setting to be the location of the remote file you wish to load, relative to BASE_REMOTE_URL. You may also specify querystring parameters here to pass to your remote file.
  3. If you wish to change the name of callback.html, then set typeurl.settings.REMOTE_CALLBACK_FILE to be the filename of the renamed file, relative to BASE_REMOTE_URL
  4. Open typeurl.xml and change the script tags to point where you will be hosting the typeurl.core.js and typeurl.local.js files.
  5. Upload all files to the server locations you specified
  6. Install http://PATH-TO/typeurl.xml as an Orkut application.
  7. Visit the installed Orkut application. If things are working, you will see a brown screen with a "Make friend request" button. This brown screen is remote.html and represents a type=url gadget not running on gmodules.com.
  8. Clicking the button should initiate several POST requests, visible in Firebug's console window. These requests are being initiated by remote.html, by using the standard google.people.requestData function
  9. Once the requests complete, the list of your friends should be displayed.

Examining remote.html will show that aside from the lines

<script src="typeurl.core.js"></script>
<script src="typeurl.remote.js"></script>

all calls to the social api function as they would with type=html gadgets

Modifying the example

Additional notes