Skip to content

Instantly share code, notes, and snippets.

@dherman
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dherman/82ca22b2ecc506d01182 to your computer and use it in GitHub Desktop.
Save dherman/82ca22b2ecc506d01182 to your computer and use it in GitHub Desktop.
<!doctype html>
<script>
function go() {
var tgt = document.getElementById("tgt");
var getSekrit = tgt.contentWindow.getSekrit;
var results1 = getSekrit();
tgt.addEventListener('load', function() {
var results2 = getSekrit();
alert(results1.concat(results2));
});
tgt.contentWindow.open("cc.html", "_self");
}
</script>
<body onload=go()>
<iframe id="tgt" src="bb.html"></iframe>
</body>
<!doctype html>
<script>
var sekrit = 42;
var getSekrit = (function(self) {
return function getSekrit() {
return [typeof self.sekrit, typeof sekrit];
}
})(this);
</script>
bb.html
<!doctype html>
cc.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment