Skip to content

Instantly share code, notes, and snippets.

@donjaime
donjaime / gist:5078567
Created March 3, 2013 22:13
PostMessage into a dynamically created iframe.
var frame = document.createElement("iframe");
frame.src="https://<the mothership's domain>/inner.html";
frame.onload = function() {
// If this is a Chrome content script, contentWindow is offlimits.
frame.contentWindow.postMessage("A Message!", "https://<the mothership's domain>");
}
document.body.appendChild(frame);
@donjaime
donjaime / gist:2836023
Created May 30, 2012 12:43
Vert.x reply handler leak
/**
* Service providing Verticle.
*/
vertx.eventBus.registerHandler("dosomething", function(message, replier) {
// Does something.
...
replier.reply({status: "OK"});
});
///////////////////////