Created
August 28, 2012 23:29
-
-
Save rauschma/3505283 to your computer and use it in GitHub Desktop.
iframe test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>instanceof test</title> | |
<script> | |
// test() is called from the iframe | |
function test(arr) { | |
var iframeWin = frames[0]; | |
console.log(arr instanceof Array); // false | |
console.log(arr instanceof iframeWin.Array); // true | |
console.log(Array.isArray(arr)); // 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