Skip to content

opengovfoundation/ep_post_message

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ep_post_message

Message posting to an etherpad hosted in an iframe

Example

// get a reference to the etherpad inner frame
var etherpadFrame = $('iframe')[0];


// send a message to the window, specifying which method you want to invoke
// check `availableMethods` in `static/js/index.js` for what's available

etherpadFrame.contentWindow.postMessage(JSON.stringify({
  callbackKey: '1234',
  method: 'getDocHeight'
}), '*');


// listen for the message event, check that the callback key matches

window.addEventListener('message', function(event) {
  var data = JSON.parse(event.data);
  if (data && data.callbackKey === '1234') {
    // do something with the result
  }
});

About

Message posting to an etherpad hosted in an iframe

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%