How to prevent web pages from being embedded in frame code?

Your web page is used by others to use it, there are some aggregator sites, at the top or bottom with their own ads and LOGO, began to crawl his station content, claiming to provide the essence of information; there are also some stations were added to the framework (Frame) resulting in traffic was brushed.

There are also some stations where frames are added, resulting in the traffic being brushed off. Being used in this way by others, although it can also increase your own traffic, unknowing readers will think that it is the content of his station, resulting in the loss of users.

What if your page is added to a frame? Here are 2 ways to do this.

<script>
if (top.location ! = self.location)top.location=self.location;
</script>
<script>
if (window!=top)
top.location.href = window.location.href;
</script>

This way, no one can embed your page, but then it's impossible to use it yourself.

Leave a Reply

Your email address will not be published. Required fields are marked *