Skip to content

Instantly share code, notes, and snippets.

@TexRx
Forked from rauschma/iframe_test.html
Created August 29, 2012 02:02
Show Gist options
  • Save TexRx/3506063 to your computer and use it in GitHub Desktop.
Save TexRx/3506063 to your computer and use it in GitHub Desktop.
iframe test
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>instanceof test</title>
<script>
// test() is called from the iframe
function test(obj) {
var iframeWin = frames[0];
console.log(obj instanceof Object); // false
console.log(obj instanceof iframeWin.Object); // true
}
window.onload = function () {
var iframeWin = frames[0];
iframeWin.document.write("<script>window.parent.test({})</"+"script>");
}
</script>
</head>
<body>
<iframe></iframe>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment