homepage Welcome to WebmasterWorld Guest from 54.167.179.48
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Defeating Framing
Brett_Tabke

WebmasterWorld Administrator brett_tabke us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 33 posted 4:52 pm on Sep 8, 2000 (gmt 0)

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()">

 

tedster

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



 
Msg#: 33 posted 6:35 pm on Sep 9, 2000 (gmt 0)

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."

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved