Skip to content

Instantly share code, notes, and snippets.

@mattsnider
Created March 30, 2013 21:03
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mattsnider/5278322 to your computer and use it in GitHub Desktop.
Save mattsnider/5278322 to your computer and use it in GitHub Desktop.
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