Skip to content

mponizil/iframe-transport

Repository files navigation

iframe-transport

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!');
});

Services

LocalStorage

Persist data across domains.

Exec

Execute arbitrary code across frames.

Example

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

Tests

$ npm test

Sauce Labs

$ npm run test-sauce

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •