Created
August 5, 2016 13:34
-
-
Save dmail/c01abe4852230aa629a127f9f63aca23 to your computer and use it in GitHub Desktop.
Testing Symbol.toStringTag across frames
This file contains 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
<HTML> | |
<HEAD> | |
<TITLE>JavaScript Example 14</TITLE> | |
</HEAD> | |
<BODY> | |
<FORM name="form1"> | |
<INPUT type="text" name="text1" size="25" value=""> | |
</FORM> | |
<script> | |
window.GLOBAL_ARRAY = []; | |
window.GLOBAL_ARRAY[Symbol.toStringTag] = 'foo'; | |
console.log('log from frame B', Object.prototype.toString.call(window.GLOBAL_ARRAY)); | |
</script> | |
</BODY> | |
</HTML> |
This file contains 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
<HTML> | |
<HEAD> | |
<TITLE>JavaScript Example 13</TITLE> | |
</HEAD> | |
<BODY> | |
<FORM> | |
<INPUT type="button" value="What is cool?" | |
onClick="parent.right_frame.document.form1.text1.value='Me!'"> | |
</FORM> | |
<script> | |
var frameB = parent.right_frame; | |
frameB.addEventListener("load", function() { | |
var frameBArray = frameB.GLOBAL_ARRAY; | |
console.log('log from frame A', Object.prototype.toString.call(frameBArray)); | |
}); | |
</script> | |
</BODY> | |
</HTML> |
This file contains 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
<HTML> | |
<HEAD> | |
<TITLE>Frames Values</TITLE> | |
</HEAD> | |
<FRAMESET cols="20%,80%"> | |
<FRAME SRC="frameA.html" name="left_frame"> | |
<FRAME SRC="frameB.html" name="right_frame"> | |
</FRAMESET> | |
</HTML> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Chrome will log
Firefox does not yet support Symbol.toStringTag so it will log