View Full Version : how do u break out of the frame?


viet_princezz
08-24-2002, 12:11 AM
what is the code that lets your visitors break out of other people's frames?

starlet
08-24-2002, 12:56 AM
By clicking a link? You just need to use your sites main URL and add target="_top" to the code like...

<a href="http://www.yoursite.com/frames.html" target="_top">Break out of Frames</a>

58sniper
08-24-2002, 01:47 AM
<script type="text/javascript" language="javascript"
if (parent.frames[1]){
top.location.href = self.location.href;
}
</script>

this will do it automatically, and is better than the Lissa method.

viet_princezz
08-24-2002, 03:52 AM
hey 58sniper, i tried that code, but when i clicked on my link in a frame to test it, nothing showed up but just a white background...

58sniper
08-24-2002, 05:28 AM
Show me your code/page

viet_princezz
08-24-2002, 05:49 AM
here is the code at the beginning of the page:

<head>
<title>* N a ' s &nbsp;&nbsp; G r a p h i x *</title>

<SCRIPT type="text/javascript" language="javascript"
if (parent.frames[1]){
top.location.href = self.location.href;
}
</SCRIPT>

<script language="javascript">
//<!--
function popup()
{ window.open ("home.html","popup","width=574,height=400,location=0,menubar=0,resizabl e=0,scrollbars=0,status=0,titlebar=1,toolbar=0") }
-->
</script>

<style type="text/css">
<!--A{color:"ffffff";text-decoration: none;font-family:"tahoma";font-weight:normal;}td {text-align:center}
A:visited {text-decoration:none; font-weight:none;font-family:"tahoma";color:white}
A:hover{text-decoration:none;color:normal;font-weight:none;position:relative;top:1px;left:3px}
A:active{color:#000000;text-decoration:none}
B {font-family :"tahoma";}font{font-family:"tahoma"; font-size:"11";}--></style>
<script type="text/javascript" language="javascript"
if (parent.frames[1]){
top.location.href = self.location.href;
}
</script>

</HEAD><body>
<center>
blah blah....the body...

</body>
</html>

Ayosu_Ling
08-24-2002, 07:59 AM
FrameBreaking is on this site. I am suprised the moderators didnt catch that one.. here is lissas page on framebreaking:
http://www.lissaexplains.com/java4.shtml

58sniper
08-24-2002, 04:17 PM
The frames script here on Lissa's site isn't the best. This version is a little cleaner.

You need to watch how you copy & paste. You were missing a LOT of closing tags, and stuff.

In <style>, you CAN NOT use quotes.

You also had the same script pasted twice, and there was the same error in both. Try this and tell me if it works:


<html>
<head>
<title>* N a ' s G r a p h i x *</title>

<script type="text/javascript" language="javascript">
if (parent.frames[1]){
top.location.href = self.location.href;
}

function popup(){
window.open ("home.html","popup"," width=574,height=400,location=0,menubar=0,resizabl e=0,scrollbars=0,status=0,titlebar=1,toolbar=0")
}
</script>

<style type="text/css">
a {
color: ffffff;
text-decoration: none;
font-family: tahoma;
font-weight: normal;
}
td {
text-align: center;
}
a: visited {
text-decoration: none;
font-weight: none;
font-family: tahoma;
color: white;
}
a:hover {
text-decoration: none;
color: normal;
font-weight: none;
position: relative;
top: 1px;
left: 3px;
}
a: active{
color: #000000;
text-decoration:none;
}
a {
font-family: tahoma;
}
font {
font-family: tahoma;
font-size: 11;
}
</style>
</head>
<body>
<center>
blah blah....the body...
</center>
</body>
</html>

Someone1
08-25-2002, 04:03 PM
What she's trying to do is open a page in a new window. She didn't need to resize the window that was opening up.

58sniper
08-25-2002, 04:09 PM
She's not resizing (nor does the code indicate that). She's breaking out of frames.

astaracheetah
06-15-2003, 08:47 AM
Well the JavaScript didn't work for me either. My page didn't show up blank, but I still got stuck in somebody's frames when I clicked on the link to my website. I'll go with the simple Lissa code.

Marianne
06-15-2003, 12:07 PM
Love your siggy, Astaracheetah!

astaracheetah
06-16-2003, 04:19 AM
LOL! I love yours, too!