Ok if you have been reading step one and two of this series, you should now have a good idea of what Open Social is all about. And you have a basic application framework that can tell you who the owner, viewer and friends of both are.
So you would think it is easy sailing from there right? So did i but unfortunatly this isn’t the case.
Most of your current prototype/scriptaculous code will be based on prototype’s ‘Ajax.Request’ ajax wrapper. However since the Open Social container is hosted on a different server then where your logic is running, this is ‘cross site’ communication, which is disallowed. So all the requests have to be tunneled thru it’s proxy’s, which breaks all the current prototype’s applications.
There are really two ways out of this, either you could do a a cross domain ajax request (for which a prototype 1.5 patch exists), but i’m unsure if the policies will always allow this, how this would trigger malware detection programs, and if it would work on all browsers, hence i decided to try to solve the problem in another way.
The end result is a Ajax.Request (and .Updater) implementation which has (roughly) the same API and options as prototype’s does, and thus allows pretty much all the the current prototype based software to run un-modified, but internally uses the containers IG_FetchContent (which goes thu the proxy server) call to retrieve the information.
Unfortunately not all the functionality can be emulated, since _IG_FetchContent doesn’t return http headers, so auto detection of json/javascript/xml headers is out of the window. So is propper error handling, since _IG_FetchContent doesn’t do errors per say, but just never returns with the content.
So the evalJSON param in the options field now means ‘parse the result as json, no matter what’, and the same for the evalJS option.
For the rest the functionality is emulated best as i could, but i’m sure over the following weeks it will be improved on heavily still. However it did so far allow me to continue building my new Open Social applications, without having to resort to arcane _IG_* API calls.
To use this library, include it after including prototype, and it will overwrite it’s Ajax.Request and Ajax.Updater classes.
The library can be downloaded here:
osAjax.js - Open Social compatible Ajax.Request implementation

February 20th, 2008 at 4:15 am
Aren’t those _IG_* API calls a part of iGoogle and I suppose OpenSocial has its own set of calls?
There was once a talk in the shindig mailing list that these IG calls will be removed since they aren’t a part of the spec?
February 20th, 2008 at 10:59 am
Hey Akash,
Yes the API has been changed (though the old calls still work too), and the calls have been moved into a nicer opensocial.* namespace, for instance its now opensocial.makeRequest() to fetch remote content; The workings are the same, but it does make it a bit more readable though

However this class still works perfectly (though i’ll update it soonish to use the new API style), and it still a nice convenience to have this functionality wrapped in an easy to use library so you don’t have to rewrite the same thing over and over again