Skip to main content

Make An IFrame To Contain Another Blog On Your Blog

One obvious way to merge two websites (either or both being a blog), is to use the same template on each, and link between the two in a consistent fashion.

The reader of either blog never has to know when he's viewing the other, unless he habitually observes the content of the browser Address window.

But how about if you would like to display one blog, in its entirety, in the middle of the other blog page? That's a feature called an IFrame.

It's an astonishingly simple feature too.

Just add the iframe code, as a new HTML gadget - or to post content.

Here's sample code, to display my original iframe post.

<iframe width="100%" frameborder="0" src="http://blogging.nitecruzr.net/2007/11/make-iframe-to-contain-another-blog-on.html" height="400"></iframe>

An IFrame can be used in a page or post - or a template gadget.

You can put an IFrame in either a blog post, or in a special page element. An iframe is a dynamic window; when you change something in the blog contained in the window, the contents of the window changes too. Just refresh, and you can see the change.

An IFrame is useful with a private blog, in place of a newfeed gadget.

An IFrame is a nice substitute for a newsfeed, when you are including a private blog in another web site. Since a newsfeed isn't available for a private blog, it's useless in this case. An IFrame works as well for a private blog as it does for a public blog. Of course, an IFrame will be useful only with viewers who have access to both the source, and target, web site.

One caveat here, which may be an asset or a liability, is that the content of an IFrame won't be picked up by the search engines. If the text inside the iframe is important content that needs to be indexed with the host blog, you won't want to put it inside an iframe. On the other hand, if you have text that you explicitly do not want indexed, an iframe can be a perfect solution.

It has a number of sizing options, that let you fit it in places.

It's got a number of settings that can make it more useful to you. You can set the height and width of the IFrame, to determine how much screen space, inside your blog, that you wish to use to display the IFrame contents. If the IFrame contents are larger than the allocated space, by default you'll get scroll bars; these can, at your own risk, be deactivated.

Remember that, as the text size is varied by the reader, the overall size of the contents inside the IFrame will vary, just as the contents of the blog outside the IFrame. Instead of specifying an absolute height or width in pixels, you can specify either in %, and have the IFrame size decrease or increase as the reader necessitates.

Complex templates, in both the host and source web site, will waste screen space.

Depending upon what effect you desire, you'll want either the IFrame host web site, or the source web site, to be as plain as possible. If you have a normal blog with a page header, post column, and one or two sidebars, you will want the IFrame source web site to have a very plain template.

If you're creating a second blog to contain posts that will be accessible only to a select few of your readers, you'll want to display an IFrame that only contains a posts column - any page header, sidebar, and / or footer section will just take up valuable screen space on the host web site, or force excessive horizontal or vertical scrolling inside the iframe window.

Comments

Gordon saidā€¦
It's still a scrolling window within your own html page which also has a browser scroll too right?
Nitecruzr saidā€¦
Gordon,

If the source of the IFrame is too wide or tall to fit in the space that you make for it, and if you enabled scrolling, you'll get a scrolled window, in the middle of your blog page, yes. Both settings are detailed in the W3Schools linked web site.
TheHipHopIcon saidā€¦
I have spent TWO DAYS looking for that simple little iframe code! THANK YOU SO MUCH!
Nick Mulder saidā€¦
Chuck youre the bomb!
JTrig saidā€¦
Thanks for the code. I've been trying to figure that out for the past couple days.
Josh saidā€¦
Thank you so much for the clear and concise instructions for embedding a blog into an existing website. One question though--is there any way to hide the Blogger navbar so it doesn't show up? I see that I can edit the colors, but can I make it disappear so that the blog looks like it is part of my webpage, and not fed in?
Nitecruzr saidā€¦
Josh,

I hid the Navbar, on my blogs, by picking the right colour. You can forceably hide it, if you really feel the need.
Peter saidā€¦
Hi! I read your article with great interest as I know very little about IFrame coding.

As I use table HTML from time to time in my blogger blog to display images and text, would it be better to use IFrame code instead? If so, what are the benefits?

Thanking you for your time.

Regards
Peter
Nitecruzr saidā€¦
Peter,

IFrames and Tables are two totally different things.

A table is a multi cell object thats used to display contents of this blog, in a grid. You control the contents of a table, and you display multiple objects, horizontally or vertically aligned with each other.

An IFrame is a single celled object, that's used to display contents of another web site. The other web site controls the contents of an IFrame, and displays that entire web site.
Alex saidā€¦
This is really sweet. Thanks for all your help on this. Is there a way to get rid of the blogger navbar in the IFrames? Maybe a hide so many pixels of the content on top? Also... the same for the bottom... in the widgets they have un-needed whitespace and I'd like to get rid of it... If I specify the height to be smaller it puts a scrollbar in there and I don't like those... so right now I have the whitespace. Any ideas?
Alex saidā€¦
Oh duh on my part about the navbar!... maybe if I just read a little but still what about the extra white space on the bottom?
Nitecruzr saidā€¦
Hi Alex,

A blog that produces a clean IFrame will have as little as possible, besides the objects being targeted, in the template code. Visible objects like blog headers, sidebars (if you're displaying posts), post columns (if you're displaying sidebar objects), and footers just take up valuable screen space, or require excessive horizontal or vertical scrolling.
Alex saidā€¦
Chuck, you are the bomb diggity! You totally rock the blogger world! Just see what you helped me do: Random Questions site! It's pretty sweet stuff and I'm excited!
Nitecruzr saidā€¦
Hi Alex,

That's a great example of the potential of the IFrame! Congrats, and thanks for the update!
Kurt saidā€¦
When I put your code in my page, it works. When I edit the name of my blog, I get a message "Could not open page". Is there a security setting I need to look at? i tried different themes - the answer is always the same.
thanks for putting this out there.
Mary saidā€¦
Chuck,

I've used your iframe code on a webiste and when an image on the blog is clicked on, the back button just closes the website.

(thanks, by the way for all your useful info which is greatly appreciated)
Martina Sujova saidā€¦
Awesome,dude!I was trying to insert my blog to my website almost 3weeks!And I was so desperate to do it that I nearly purchased a Ā£99 product which was promising to do it. I can not believe that I needed just one small code!Thank you so much.
Riderz Collective saidā€¦
I'm in the same boat as Kurt, I used the code which worked great!! but when and I changed the blog address to my blog address it keeps giving me the below error message.

Page Not Found

Sorry, the page you were looking http://xxxx for does not exist.. but you can click on the page that doesn't exist and opens up my blog...

Not sure how to fix it?? Any help would be appreciated.

Thanks
Naveen saidā€¦
Thanks. I needed this iframe code for my blogger.
false saidā€¦
I am still seeking a way to auto size the height of the iframe based on the height of the page being displayed inside the iframe.

On my website: http://www.loanburger.com/ I have my Blog showing on the Home page inside the iframe. I have to limit the nr of posts displayed to one or two to make sure the iframe's scroll bars do not appear. There must be a way to get around this and have the iframe increase its size
Aaron V saidā€¦
To Loan Burger. Try this. You can then adjust the height and width as you see fit.

http://YOUR_BLOG_NAME_HERE.blogspot.com"
allowtransparency="true" style="border: none; width: 800px; height: 800px;"></, but it will not let me post this with it in the code
Sagar saidā€¦
How do I Add TEXT in a Iframe ?
Anyone having any !dea ?
http://www.speedyvehicles.in
Nitecruzr saidā€¦
Sagar,

You have to add the text to the website that the frame sources. An iframe is purely another website, sourced there. If you want text above, beside, or below the display, add it to your blog, in the right position.
Anonymous saidā€¦
Thanks! After I removed the html piece it works great....even with the scroll bars!
RG2Cents saidā€¦
Hi! Thanks for the iframe code, but I need a little more advice. The iframe works fine but when I try to post a comment, it replaces my page with the login page. Is there anyway I can make it do this in the iframe and not close my page?
Nitecruzr saidā€¦
RG,

Any activities within an iframe that require authentication, like commenting - or Following, have to be logged in separately, within the iframe.
RG2Cents saidā€¦
Thanks Chuck! I think the reason it was acting funny was that I was working a test page on my 'puter, and hadn't published it on the web yet. Thanks for the advice! :D
Unknown saidā€¦
Hi,
I have an iframe on my website that pulls information from my blog page and displays it in the iframe, all that works fine. The problem is I have anchors on my home that should link with id tags on the blog, so when you hit those links is should take you specific information in the iframe, which which is my blog page. I set the id up on the blog page. It doesn't work. Is there a way to do this?
Nitecruzr saidā€¦
Jennie,

Anchor tags are a known problem with IFrames. I'm not confident that there is a solution for you - if there is, you'll find it faster by asking in BHF: Something Is Broken.
J.P. Kallio saidā€¦
ok, i tried to find this info but my terminology probably fails me on the search so maybe you can help me? I put my blog on my website with iframe, but I am wondering is there anyway to get the blog to resize to fit the iframe? I don't mind having the horizontal scroll bar, but would love to have the width of the blog appear the same as the iframe (810pix)
here's the page at the moment:
http://www.jpkallio.com/blog.html
Is this possible to do?
David saidā€¦
your the man Chuck, I did some complicated and stupid things just to be able to do what the amazing Iframe can accomplish in three lines of code
Dr. Kathy Nickerson saidā€¦
Great post, thanks, it worked perfectly!
Raquel Byrnes saidā€¦
I have a book coming out later this year and wanted to have a special code on my bookmarks that will unlock an unpublished chapter.

How would I go about setting that up?

Is it even possible?

Edge of Your Seat Romance
Unknown saidā€¦
thx a lot buddy!!!
Works great! Yay! THank you!
Daniel H. Herman saidā€¦
Thanks a lot, I like it!
Unknown saidā€¦
Awesome, Awesome, Awesome!!! Thanks, that works perfectly in my site! If anyone wants to see what that simple (yet very effective) iFrame html does, just check out my site--

http://www.blainelight.com/blog.html
GeeSince83 saidā€¦
Hi there, is there any to have just the post visible in the iframe?
Nitecruzr saidā€¦
Gee,

By specifying the proper frame target, you can have the specific post URL show up. You cannot, unfortunately, get just the content of the post - omitting the blog title, sidebar, footer, etc.
Alex Bland saidā€¦
Absolutely brilliant thanks.
Can't believe this is so simple.
Unknown saidā€¦
thankyou very much dude, you're making my live easier
Unknown saidā€¦
That's a great tip! However, I only want to show a list of all the posts under a certain label (src="/search/label/Labelname"), but it displays the header and footer of my blog too. How can I get rid of the header and footer? Thanks!
Nitecruzr saidā€¦
Brian,

An IFrame is going to show the blog, as displayed.

If you only want the posts, for a given label, try a feed reader, targeting the label feed.

http://blogging.nitecruzr.net/2007/09/combining-feeds-and-labels-to-get-feeds.html
Alex saidā€¦
how can I put only post from other blogs in the iframe, just post, not the whole blog. thanks for your reply
Nitecruzr saidā€¦
Alex,

One of the downsides of iframes is that you cannot select a portion of the iframe, It's all, or nothing.

If you only want the posts from a blog, that's what the posts newsfeed is for. No iframe - just a feed gadget.

http://blogging.nitecruzr.net/2007/07/what-is-my-blog-site-feed.html

Popular posts from this blog

What's The URL Of My Blog?

We see the plea for help, periodically I need the URL of my blog, so I can give it to my friends. Help! Who's buried in Grant's Tomb, after all? No Chuck, be polite. OK, OK. The title of this blog is "The Real Blogger Status", and the title of this post is "What's The URL Of My Blog?".

Add A Custom Redirect, If You Change A Post URL

When you rename a blog, the most that you can do, to keep the old URL useful, is to setup a stub post , with a clickable link to the new URL. Yo! The blog is now at xxxxxxx.blogspot.com!! Blogger forbids gateway blogs, and similar blog to blog redirections . When you rename a post, you can setup a custom redirect - and automatically redirect your readers to the post, under its new URL. You should take advantage of this option, if you change a post URL.

Adding A Link To Your Blog Post

Occasionally, you see a very odd, cryptic complaint I just added a link in my blog, but the link vanished! No, it wasn't your imagination.