Snippets

Barry Smith _blank Tab hack

Created by Barry Smith
1
2
3
4
5
6
7
8
<script>
	if (window.opener) {
		opener.location = 'https://mathiasbynens.github.io/rel-noopener/#hax';
		// Just `opener.location.hash = '#hax'` only works on the same origin.
	} else {
		document.querySelector('h1').innerHTML = 'The previous tab is safe and intact. <code>window.opener</code> was <code>null</code>; mischief <em>not</em> managed!';
	}
</script>

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.