Created
May 30, 2010 21:58
-
-
Save miya2000/419354 to your computer and use it in GitHub Desktop.
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
javascript:(function(){ | |
var ifr = document.createElement('iframe'); | |
ifr.src = 'data:text/html;charset=utf-8,%3Chtml%3E%0D%0A%3Cbody%3E%0D%0A%3Cscript%20type%3D%22text%2Fjavascript%22%3E%0D%0Awindow.addEventListener(%22message%22%2C%20receiveMessage%2C%20false)%3B%0D%0Afunction%20receiveMessage(e)%20%7B%0D%0A%20%20%20%20alert(localStorage%5B%22aaa%22%5D)%3B%0D%0A%20%20%20%20localStorage%5B%22aaa%22%5D%20%3D%20e.data%3B%0D%0A%20%20%20%20alert(localStorage%5B%22aaa%22%5D)%3B%0D%0A%7D%0D%0A%3C%2Fscript%3E%0D%0A%3C%2Fbody%3E%0D%0A%3C%2Fhtml%3E%0D%0A'; | |
document.body.appendChild(ifr); | |
ifr.addEventListener('load', function() { | |
alert('post'); | |
ifr.contentWindow.postMessage('aaaaaaaaaa', '*'); | |
}, false); | |
})() |
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> | |
<body> | |
<script type="text/javascript"> | |
window.addEventListener("message", receiveMessage, false); | |
function receiveMessage(e) { | |
alert(localStorage["aaa"]); | |
localStorage["aaa"] = e.data; | |
alert(localStorage["aaa"]); | |
} | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment