Welcome to WebmasterWorld Guest from 54.226.147.190

Forum Moderators: open

Message Too Old, No Replies

Frame buster scripts

Why are they all different?!

     

geekay

9:49 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



I have been looking at frame breaking scripts, but I only get confused. How can there be so many different versions, all of which claim to do about the same thing? Some are to be put in the Head, some in the Body. Some start with:

<script type="text/javascript">
other with:
<script language="javascript">
yet other with:
<script typ="text/javascript" language="JavaScript">

String alternatives include:
if (top!= self)
top.location.href = self.document.location;

if (parent!= self)
{top.location.href = location.href}

if (top.frames.length!=0)
top.location=self.document.location;

if (window!= window.top)
top.location.href = location.href;

if (self!= top) top.location.href = self.location.href;

if (parent.frames.length > 0) {
parent.location.href = location.href;
}

if (top.location!= location)
top.location.href = document.location.href ;

if (top!= self) top.location.href = location.href;

jdMorgan has an interesting and rather recent solution at:
[webmasterworld.com...]

EVERY script I have seen is different! Why? My own site is unframed and like most I would only need something simple that works in modern browsers and preferrably does not disable the Back button.

Finally, I also found this:
<meta http-equiv="window-target" content="_top">
It would be nice if it works, as some people browse JS disabled. Could having both Meta and Script on my page solve that problem?

g1smd

9:57 pm on Jan 21, 2005 (gmt 0)

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



Why are there differences?

Simply because there is more than one way to get the job done.

I like to put javascript in extenal files and call the code with a one-liner in the <head> section, javascript being the last stuff in the head section before the ending </head> tag.

.

Just look at Windows. To close a window: use Alt-F4, or click the X at top-right, or click the image at top-left and then click "Close" in the drop down list that appears, or press Control-X, or...

kaled

12:20 pm on Jan 22, 2005 (gmt 0)

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



You should always use location.replace(newurl) otherwise the back button breaks.

Kaled.

Bernard Marx

1:19 pm on Jan 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doesn't that give the possibility of an "access denied".
(Not a rhetorical question).

larryhatch

1:48 pm on Jan 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Kaled:

" You should always use location.replace(newurl) otherwise the back button breaks."

Very good advice! I did exactly that from earlier advice you kindly provided.
I tried various methods but your's was the best.

There is only one downside, my _apparent_ hits counts dropped.
Why? Because formerly, people would back out of my framed page, only to wind up in
the referring page .. back and forth endlessly!

Now, they end up in a new window and the tennis-ball effect is eliminated.
Sure, my hit counts are lower, but they are also more realistic. Thanks again - Larry

encyclo

1:52 pm on Jan 22, 2005 (gmt 0)

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



Another good discussion about frame-breakers here:

[webmasterworld.com...]

geekay

3:27 pm on Jan 22, 2005 (gmt 0)

10+ Year Member



Thank you, encyclo. I only searched this site for "frame breaking" and "frame buster", but not for "frame breaker".

But what is the difference between "text/javascript" and just "JavaScript" in the beginning?

Is anyone able to comment on that Meta solution at the end of my OP?

larryhatch

3:34 pm on Jan 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Encyclo:

I hope this isn't too divergent from the main thread here. But!
How do you feel when some valued page(s) of yours are framed by another site?

Personally, I feel somehow insulted or ripped off.

It is as if the other site is including your or my work as a part of theirs..
that they somehow own your works.

I hope that the major SEs pass PR and any other credits normally given
via a straight link to any site that is "framed".

Not to do so would be an injustice to the browsing public, not to mention the source. - Larry

g1smd

4:51 pm on Jan 22, 2005 (gmt 0)

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



The type="text/javascript" is a REQUIRED attribute. It must be there for your HTML page to be valid code.

The language="javascript" is an older attribute, for some ancient browser (IE3?, NS3?, NS4?, so long ago I no longer remember), and can be left out if you want.

Add a DOCTYPE above the first <html> tag, and then run the page through [validator.w3.org ] to make sure there are no other HTML coding errors.

encyclo

2:37 pm on Jan 24, 2005 (gmt 0)

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



I hope this isn't too divergent from the main thread here. But!
How do you feel when some valued page(s) of yours are framed by another site?

Larry, I use a frame-busting script on every single page of every site I control - I dislike any framing of my contents under almost any circumstances. I don't think I'm the only person here with that opinion!

larryhatch

5:45 am on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi encyclo: I put in frame busters on all my pages too.
Now, as I rewrite them one or two a day for other reasons,
I change the buster to Kaled's method (see above) which works even better. - Larry

matt621

7:58 pm on Mar 5, 2005 (gmt 0)

10+ Year Member



What about frames from within your own site? Especially iframes? Does this bust your own frames as well, or only others outside your site from framing your site?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month