Skip to content

Instantly share code, notes, and snippets.

@disinfeqt
Created May 31, 2012 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save disinfeqt/2841321 to your computer and use it in GitHub Desktop.
Save disinfeqt/2841321 to your computer and use it in GitHub Desktop.
<script>
function bust () {
document.write = "";
window.top.location = window.self.location;
setTimeout(function() {
document.body.innerHTML = '';
}, 0);
window.self.onload = function(evt) {
document.body.innerHTML = '';
};
}
if (window.top !== window.self) { // are you trying to put self in an iframe?
try {
if (window.top.location.host) { // this is illegal to access unless you share a non-spoofable document domain
// fun times
} else {
bust(); // chrome executes this
}
} catch (ex) {
bust(); // everyone executes this
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment