Shutterbug API
Shutterbug is used widely in Lab and in LARA, it uses postMessage to request child iFrames HTML content for snapshotting.
The basic PostMessage API Calls that are used in the shutterbug javascript project are documented in the github repo
Shutterbug Messages
htmlFragRequest
Parent asks iframes about their content:
var message = {
type: 'htmlFragRequest',
id: id, // Shutterbug ID
iframeReqId: iframeId, // position of iframe in dom
iframeReqTimeout: this.iframeReqTimeout * 0.6
};
window.postMessage(JSON.stringify(message), "*");
And an Iframe sends its content back:
var response = {
type: 'htmlFragResponse',
value: html,
iframeReqId: iframeReqId, // counter, from request
id: id // sender_id from request
};
source.postMessage(JSON.stringify(response), "*");