Skip to content
PostMessager is a MooTools wrapper for the window.postMessage API.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


PostMessager is a MooTools plugin that acts as a wrapper for the window.postMessage API which is available in IE8+, Firefox 3.1+, Opera 9+, Safari, and Chrome. PostMessager also normalizes the onMessage event for use within MooTools.


How to Use

PostMessager instances can be created at any time. Two arguments are accepted: the destination window and the instance options.


/* Get hold of an iFrame */
var domain = '';
var iframe ='listenerFrame').contentWindow;

/* Create a PostMessager instance */
var messager = new PostMessager(iframe,{
    allowReceive: true,
    allowSend: true,
    validReceiveURIs: [''],
    onSend: function(message,dest) {
        console.log('sending "',message,'" to ',dest);
    onReceive: function(message,source,origin) {
        console.log('received message "',message,'" from ',origin,' at ',source);
        this.reply('Got it!',source,origin);

/* Send a message to the iFrame! */
messager.send('Hello from the parent window!',domain);

PostMessager handles sending, receiving, and replying to messages. Optimally you would add an instance to each frame.

For specific usage and options, please read the documentation or visit

Something went wrong with that request. Please try again.