Revision: 70034
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 4, 2015 19:10 by apphp-snippets
Initial Code
<script type="text/javascript">
var prevent_bust = 0;
window.onbeforeunload = function() { prevent_bust++; }
setInterval(function() {
if (prevent_bust > 0) {
prevent_bust -= 2;
window.top.location = 'http://domain.com';
}
}, 1);
</script>
Initial URL
www.apphp.com/index.php?snippet=javascript-anti-iframe-buster
Initial Description
You know that iFrames are a necessary evil for many of us. When yuo put a third party site in an iframe is always a risk because they can break out of that iframe and redirect the visitor to another location. This code acts as a defense for such cases and prevents them from being able to bust out of the iframe.
Initial Title
Anti iFrame Buster in JavaScript
Initial Tags
javascript
Initial Language
JavaScript