Created
July 31, 2013 06:24
-
-
Save cou929/6119775 to your computer and use it in GitHub Desktop.
以下の html に "hash_sample.html#foobar" というように hash 付きでアクセスする。IE 系は location.hash が取れないがそれ以外のブラウザだととれる。また document.write した script から見えている window.location はもとの 'hash_sample.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> | |
<body> | |
<script> | |
var iframe = document.createElement('iframe'); | |
document.body.appendChild(iframe); | |
var iframe_doc = iframe.contentWindow.document; | |
iframe_doc.write('<html><body><sc' + 'ript>alert(window.location.hash)</sc' + 'ript></body></html>'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment