Created
November 29, 2011 08:14
-
-
Save iangreenleaf/1403976 to your computer and use it in GitHub Desktop.
Twitter doesn't know shit about frontend
This file contains hidden or 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
// This came straight from Twitter's index.html. Enclosed in <script> tags. | |
// Apparently they do not know about minifiers, or the document-ready event. | |
// Magical invocations for frame-busting is a great plan, though. | |
// No, I don't know what their goddamn problem is either. | |
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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment