Prevent other Websites from Embedding Content using iFrame

Have you ever came across a website that is plagiarizing content from your site using iFrame HTML element and ranking higher than your domain in Google Search Results? If you ask me this same question, I would say

feedreader iframe code

This website was constantly stealing almost every post from my previous blog using iFrame on (See screenshot here) and lookup.feedreader.comAnd, because of this my domain name not only disappeared from Google search results, but was also penalized (Screenshots here and here)!


Because of following reasons:

  • The domain authority and Pagerank of Feedreader is higher than my previous blog
  • The site was reading and publishing exact date and time stamp for all published articles from my blog’s feed – See above screenshots for Date!

As a result, Google bot started considering my blog articles as duplicate copies of Feedreader!


1. Use Frame Killer Script

I deployed following iFrame breaker JavaScript:

<script type=”text/javascript”>

if(!==window.self || top != self){;top.location.replace(location);}


You are required to place this script just after the <head> section of your site (See example). If you are using WordPress, then you need to edit your header.php file OR open a support ticket with your theme developer.

As soon as the above script is placed on your site, your web server will check every time whether your site has been embedded on some other website within an iFrame tag or not. If your web server detects one, then the page on other site will get redirected (This is not a 301 redirection) to the original URL on your site:

2. Convert your feed into summary

If your website also provides your published content via RSS, then you should summarize it, instead of providing full content in the feed, as this will attract feed scrapers in bulk!

If you are using WordPress as your CMS, then you can go to Reading Settings in Dashboard >> Select Summary for For each article in a feed, show and click on Save Changes:

wordpress reading settings summary

As of now the above solutions are working, but there are Framekiller killers (scripts) also! So, it’s better to report such websites to Google Web SPAM Team. Also, I will highly suggest you to file a DMCA report with Google (and maybe Bing) against such websites (See example).

3 replies on “Prevent other Websites from Embedding Content using iFrame”

G’day! Thank you as this article is very interesting; one I am sharing today!
Cheers! Joanne

The code is generally placed immediately after HTML HEAD tag. I don’t have any experience with code igniter, but there should be HTML HEAD tag in it. You can place the code just after opening HTML HEAD tag and before closing HTML HEAD tag.

Comments are closed.