No description, website, or topics provided.
JavaScript HTML CSS
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Build Status

Orchestrates messages between an IFrame and its parent page, as well as between IFrames on the same page. The Iframes can even reside on different domains!

I realize this looks a bit outdated functionally; after all, who uses IFrames anyway!?

Well if you're asking yourself that question, clearly you're not a SharePoint developer. In SharePoint 2013, Provider Hosted

Apps are rendered inside of IFrames, which on occasion lands you with a mess of a dashboard page.

This tool will allow you to establish a communication pipeline between each IFrame and its’ parent, easing a lot of pain.

To take this a bit further, you'll also be able to pass messages (strings of JSON objects) between IFrames.

The motivation behind this tool was for complex SharePoint apps, but there's no dependency to SharePoint.


This tool relies heavilly on postMessage.

This means that it's supported by the majority of browsers, even older ones.

See here the browser support table: CanIUse



Via [Bower][]:

$ bower install iframe-orchestrator

Typical usage

The trick is done by 2 javascript files, one on the global page (IFrameOrchestrator.js) and another one on each page that renders inside an IFrame (IFrameOrchestratorClient.js).


  • IFrameOrchestrator.js if referenced and initialized on the header of the global page.
  • IFrameOrchestratorClient.js is referenced at the end of the body of the child page.


Global page (page containing the IFrame(s))

	<title>IFrame Orchestrator Demo</title>

	<script type="text/javascript" src="IFrameOrchestrator.js"></script>
	<script type="text/javascript">
			logging: true,
			allowedOrigins: [

Page that will be displayed inside the IFrame

<script type="text/javascript" src="IFrameOrchestratorClient.js"></script>

See complete example in the source code, demo folder.



default: false
type: boolean
Setting the logging option to true will show a lot of information on the console that might be usefull for troubleshooting.


default: all
type: array
Setting the allowedOrigins property with an array of domain with enforce a security check, allowing only trusted domains the pass. This expects the protocol, i.e.: ['', '']

Main Page Methods (IFrameOrchestrator.js)


key: property name
value: property value
Set a property value in the global scope.
Property names are just strings but it's recommended to use namespaces on the property names to avoid collisions.
Values can be whatever you want, from base types to json objects or even functions.

var ifo = IFrameOrchestrator({ ... });
ifo.setProperty('', 'AlexCode');
ifo.setProperty('global.entity', { name: 'AlexCode' });


key: property name
Get a property value from the global scope.

var ifo = IFrameOrchestrator({ ... });

subscribeEvent(name, handler)

name: event name
handler: callback function that is called each time the event is triggered Subscribes to an event from the host. This allows to execute tasks on the host page upon events triggered anywhere.


name: event name
Triggers an event from the main page. These events can be subscribed either on the host or the clients.

Client Methods (IFrameOrchestratorClient.js)


key: property name
value: property value
Set a property value in the global scope. This property value can be accessed by the main page or even by other IFrames. To avoid naming collisions, consider a prefix for these property names.

iframeOrchestratorClient.setProperty('iframe1.someValue', 'AlexCode');


key: property name
callback: callback function to receive the value
Get a property value from the global scope. The result will be given in the given callback.

iframeOrchestratorClient.getProperty('iframe1.someValue', function(value){ console.log(value); });


name: event tame
handler: callback function that is called each time the event is triggered
Subscribes to an event and the callback is called each time the event is triggered.


name: event tame
Unsubscribes an event.


name: event tame
data: data to be passed to the event handlers
Triggers the event. All the subscribers will be notified.