IFrameBridge
Very basic wrapper around window.postMessage. Handles handshaking and JSON conversion. Makes sure you don't lose any messages.
Install from npm:
npm install --save iframe_bridge
Then in your ES6+ code:
const IFrameBridge = ;
or
;
Usage
iframe_bridge.js
file is the compiled browser-ready version of the library. If you reference it with <script>
tag, the constructor will become available globally as window.BrowserBridge
. You can also require it from within an ES6 app with your own build system (see above).
Example usage:
(index.html)
(iframe.html)
You can see a working example here: tester/index.html.
Additional options
Check out DEFAULT_OPTIONS
inside IFrameBridge.js for the full list with comments.
This object will be available (and mutable) on IFrameBridge.DEFAULT_OPTIONS
.
License
MIT