Skip to content

Instantly share code, notes, and snippets.

@lakenen
Last active August 29, 2015 13:57
Show Gist options
  • Save lakenen/9825400 to your computer and use it in GitHub Desktop.
Save lakenen/9825400 to your computer and use it in GitHub Desktop.
Empty hash document.write focus bug
<!DOCTYPE html>
<html>
<head>
<style>
iframe {
margin-top:10000px;
}
</style>
</head>
<body>
<iframe></iframe>
<script>
document.location = '#';
setTimeout(function (){
var iframe = document.querySelector('iframe');
iframe.contentDocument.open();
iframe.contentDocument.write('hi');
iframe.contentDocument.close();
}, 1);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment