An open API service indexing awesome lists of open source software.

https://github.com/fetch/frame-bridge

Minimal JS frame bridge, using window.postMessage
https://github.com/fetch/frame-bridge

Last synced: 10 months ago
JSON representation

Minimal JS frame bridge, using window.postMessage

Awesome Lists containing this project

README

          

# FrameBridge JS

Minimal frame bridge, using `window.postMessage`.

To communicate between two frames you simply instantiate an instance of `FrameBridge` in both parent and child.

Take for example the following parent page:

```html

var frame = document.getElementById('child-page');
var bridge = new FrameBridge({target: frame});

bridge.on('setFrameHeight', function(height){
frame.height = height;
});

```

With a child page like this:

```html

....

var bridge = new FrameBridge();
window.onload = function(){
bridge.trigger('setFrameHeight', document.body.clientHeight);
};

```

This would resize the frame in the parent window to match the actual size of the content.