Welcome to WebmasterWorld Guest from 107.22.87.205

Forum Moderators: incrediBILL

Message Too Old, No Replies

Defeating Framing

     
4:52 pm on Sep 8, 2000 (gmt 0)

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



What do you think, is this the best way (compat/easiest) to defeat framing? (eg: we suddenly are getting killer traffic from ask jeeves and I can't deal with being framed. It makes me want to write one of those nasty back button killers under 10 redirects).

<SCRIPT Language="JavaScript">
<!--
var real_location = "http://www.yourshere.com/";

function nogojoe () {
if (top.location) {
if (self != top) top.location = self.location;
}
else {
if (parent.location) {
if (parent.location != real_location) parent.location = real_location;
}
}
}
//-->
</SCRIPT>

<BODY onLoad="nogojoe()">

6:35 pm on Sep 9, 2000 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The code I use is:

if (parent != self) top.location.replace("yourpage.html");

I prefer the replace() method because the browser history remains intuitive. However, replace() is JavaScript 1.1. For greater compatibility, this code:

if (parent != self) top.location="yourpage.html";

is entirely JavaScript 1.0. But it does add an extra entry to the browser history.

Once you test to see if there is a parent for your page, the exact window configuration doesn't really matter, as I see it. So this code just says "Do I have a parent? If so, load me at the top level."

 

Featured Threads

Hot Threads This Week

Hot Threads This Month