Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Cross-Domain Iframe Receiver Using Hack-Hack
var HashHack = {
PREFIX: '#hhMessage=',
postMessage: function(el, sMessage) {
if ('string' === typeof el) {
el = document.getElementById(el);
var sUrl = el.src.replace(/#.*/, '');
el.src = sUrl + HashHack.PREFIX + encodeURIComponent(sMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment