Bi-directional RPC over iframe. Targets modern browsers, IE8+.
ift.parent({
childOrigin: 'http://childapp.com',
childPath: '/child.html'
}).ready(function(manager) {
var channel = manager.channel('test');
channel.request('hello', ['child!'], function(response) {
console.log(response); // hello parent!
});
});
var manager = ift.child({
trustedOrigins: ['http://parentapp.com']
});
var channel = manager.channel('test');
channel.on('request', function(id, method, params) {
console.log(method, params[0]); // hello child!
channel.respond(id, 'hello parent!');
});
LocalStorage
Persist data across domains.
Exec
Execute arbitrary code across frames.
Start two servers, one on port 8000
and one on port 4000
:
$ http-server -p 8000
$ http-server -p 4000
Open http://127.0.0.1:8000/example/parent.html
$ npm test
Sauce Labs
$ npm run test-sauce