See http://easyxdm.net for the main website, or http://kinsey.no/blog/index.php/tag/easyxdm for blog posts about it
This page is no longer in use
A javascript library that uses available techniques to to provide a means of transporting messages and/or method calls between windows in different domains.
This library has changed its name to easyXDM
The main repository has moved to http://github.com/oyvindkinsey/easyXDM/. This repository is only kept ut to date for analysis by Ohloh.net.
For downloads, please see https://www.ohloh.net/p/easyDM, which is easyXDM's new home away from home
The library is currently implementing postMessage for browsers that supports this and will fall back to using the IFrame URL Technique for all others, including IE6.
Perfect for API providers
This is perfect if you plan to provide a client-side API on your web site as you can expose a method in as little as 10 lines of code. And also, you don' have to provide a full client library to the consumers, you can just tell them to implement your exposed EasyXSS-interface, and that can be as small as 1 line for a one-method interface!
Example
In the document on your server providing the API you put:
var remote;
var channel = easyXSS.createChannel({
onReady: function(){
remote = easyXSS.createInterface(channel, {
local: {
doMagic: _privateMethodDoingMagic
}
});
}
});And then you tell your consumers to implement the remote interface as defined by
{
remote:{
doMagic: {}
}
}In total, the code the consumer would have to implement would look like this:
var remote;
var channel = easyXSS.createChannel({
local: "/hash.html",
remote: "http://yourdomain.com/api.html",
onReady: function(){
remote = easyXSS.createInterface(channel, {
remote: {
doMagic: {}
}
});
}
});And then they would be able to call your API using
remote.doMagic('argument1',2,'three',function(result){
// Consume the result
}To use the library copy the hash.html document and the easyxss.js file to your server, and follow the examples on SendingMessages, SendingData and InvokingRemoteMethods.
In all the examples you can copy the 'main document' part to your own server and test it against the example.
hash.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="CACHE-CONTROL" content="PUBLIC"/> <meta http-equiv="EXPIRES" content="Sat, 01 Jan 2050 00:00:00 GMT"/> <script type="text/javascript"> window.parent.parent.easyXSS.onReady(location.hash.substring(1)); </script> </head> <body> </body> </html>
This only needs to be present on the domain initiating the channel.