JavaScript: Break Frames
Introduction
Author: Martin WarningYear: 2007
License: Free
Page hijacking is something that can happen to your pages. Page hijacking is when another site loads your pages inside their frames, thus making the user believe your content belongs to another site. A simple JavaScript code can solve this issue.
Code
Languages:- JavaScript
<script language="javascript">
//<![CDATA[
if (parent.location.href != self.location.href) {
window.location.href = self.location.href;
}
// End -->
//]]>
</script>
In this example we compare the parent location url value and compare it with the url value of our own page. If the 2 are not the same we open our page in place of the frame, thus busting out of the frame.