Webmaster Questions and Answers
Question: Two years ago I saw that
there is a simple way using the Frames tag to keep my page
from being "framed" by another Website. What is this technique?
Answer: Excellent question. There
are two popular Javascripts being used to keep other sites
from framing your Website. I've listed both directly below
(you need only use one or the other).
FIRST OPTION:
<SCRIPT TYPE="text/javascript">
<!--
function breakOut() {
if (self != top)
window.open("my URL","_top","");
}
// -->
</SCRIPT>
</HEAD>
<BODY onLoad="breakOut()">
SECOND OPTION:
<SCRIPT TYPE="text/javascript">
<!--
if (top.frames.length!=0)
top.location=self.document.location;
// -->
</SCRIPT>
Put one of these scripts on the page you
don't want framed and other sites won't be able to successfully
frame your page within their site. You must put the script
on every page you don't want framed.
Joe Tracy
» To
Submit a Question Click Here
» Return to Ask
The Editor Main Page
» Return to Webmaster Techniques
Front Page
|