PDA

View Full Version : Busting out of Frames?


Top Hat
27th February 2006, 15:42
A while ago I added some code to our pages to break out of frames, basically other sites were loading our site into a frame on their site.

<SCRIPT language="JavaScript"><!--
if (parent.frames.length > 0) {
parent.location.href = location.href;
}
// --></SCRIPT>

The code works well in that it breaks out of frames, but it breaks the back button as well (only if it was framed)

Should I dump this code?


Supplementary Q

<meta name="MSSmartTagsPreventParsing" content="TRUE">

Can I get rid of this now too?

Coding Monkey
27th February 2006, 15:55
Second point, yes. Technically (no point in removing it) but you also don't need


<META NAME="ROBOTS" CONTENT="INDEX,FOLLOW">


As this is a default.

DuaneJackson
27th February 2006, 16:32
Why are you worried about the back button if it will only take the user back to the site that cheekily framed your content?

I take it it doesn't effect the use of the back button for regular visitors?

mattk
28th February 2006, 07:47
Duane - It's bad karma to break the back button, man!

Mac - Yes, it is default, but it gives you that warm, fuzzy feeling inside knowing that robots know exactly what to do when they visit your pages.