...

View Full Version : "am I in a frameset" detector



mouse
06-27-2002, 06:15 PM
Is it possible for a page to detect whether it's in a frameset and disply - or not - a break frames button?

:eek::eek::eek:

whackaxe
06-27-2002, 06:23 PM
if (top.location.href != location.href)
{
if(confirm("do you want to break these frames?"))
{
top.location.href = location.href
}
}

that script should pop up a box asking if you wna to breakt the frames and if the user clicks yes then they pop!

requestcode
06-27-2002, 06:38 PM
You could also place a script in the body section of your document to write out a link if it is in frames like this:
<html>
<head>
<title>Break out of frames link</title>
</head>
<body>
<TABLE ALIGN="center" BORDER="1" WIDTH="50%" HEIGHT="20%" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD ALIGN="center" VALIGN="top">
<SCRIPT LANGUAGE="javascript">
if (window != top)
{
document.write("<A HREF='javascript:top.location.href = location.href'>Break Out of Frames</A>")
document.close()
}
</SCRIPT>
</TD>
</TR>
</TABLE>
</body>
</html>

If you don't want a text link then you could also use an image. If you want a form button then you could write the appropriate form tags. Good Luck.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum