How To Stop Sites From Opening Your Blog In A Frame


OK this is another post that comes from a readers question.They said "I use Networked Blogs to auto share my posts on Facebook but when you click the link on Facebook it shows the page with a bar at the top and a different URL".

This is in fact called a frame and some websites display pages from other sites within a frame, Stumble Upon would be a good example as indeed is Networked Blogs.While I feel Stumble Upon has a reason for this many websites do it to keep people on their site, some even take credit for your content.


In the first image you see how the blog usually looks :

Here we see the blog within the Networked Blogs frame.In the address bar you can see the URL is Networked Blogs (In Green) and a bar runs across the top of the page (In Red) :

We can fix this and add a line of script to your template that detects when your blog is being placed in a frame and overrides the frame.This tutorial is for Blogger Blogs but the code will work on any site.

Stop Your Blog Opening In A Frame

Step 1. In Your (New Design) Blogger Dashboard Click The Drop Down Menu For Your Blog > Choose Template > Then Edit Html > Now Proceed as shown in the video Below :

Step 2. Find the following piece of code in your blogs Html : (Click Ctrl and F for a search bar to help find the code - How To Find Code In Blogger Template Template)

Step 5. Now Copy And Paste This Code Directly Above / Before </head>

if (window != top) top.location.href = location.href;

Finally save your template.

Now your blog will no longer open in frames.Drop your comments and questions below.

AuthorAuthor - Paul Crowe is the owner and main author of Spice Up Your Blog.Paul lives in Ireland, has been blogging since 2006 and writing Spice Up Your Blog since 2009.You can find him in the usual social networks.

Join over 5000 Subscribers! Please sign up to receive Updates.

SUYB has its Focus on Quality. If we post Crap, you can unsubscribe.

No Spam and No Garbage! - Use RSS, Twitter & Facebook as an Alternative

If You Enjoyed This Post Please Take 5 Seconds To Share It.


  1. I did not realize this could happen thanks for giving us a way to stop it I added the code to my blog.

  2. It is in reality a great and useful piece of information. I am satisfied that you simply shared this helpful information with us. Please keep us informed like this. Thanks for sharing.
    website design

  3. I think there is an option to not to display in frame on Networked Blogs

    1. Networked Blogs was only used as an example of a site that uses frames.Lots of other sites use frames and the code will stop it on any site.

  4. Really this is nice Technic .

    Now a days many people are iframing the pages of other sites

  5. Well it's really annoying to open sites in frames and I guess this tutorial is really helpful


Important - If you ask a question make sure you tick the "Notify Me" box below the comment form to be notified of follow up comments and replies.

Hire Us