Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Adjust width & height of iframe to fit with content in it: Problem solved

Ifrmae is an inline frame which is used to Embed videos and documents from another link into the webpage or into the post. Very often we feel the necessity to embed various videos or many other document to make it live to make our post informative and more attractive. This can be done with a simple Iframe tag of HTML and iframe generator  But problem occurs when when we embed it on the page. The problem is to fix height and width of the content or videos that we embed into the pages. If we do not know HTML very well we can not do so. Again doing so is very hazardous task if we know HTML and it takes a lot of time. So making iframe tag manually for embedding something is not an easy task because it kills times and labors. So I have iframe code with java-script that solve the problem automatically. It will automatically adjust the width and height to make it fit for the post body. So friend try this code and set it to your page. Try this code it will solve the problem completely and it's simple:

<script language="JavaScript">
<!--
function autoResize(id){
var newheight;
var newwidth;

if(document.getElementById){
newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
}

document.getElementById(id).height= (newheight) + "px";
document.getElementById(id).width= (newwidth) + "px";
}
//-->
</script>

<IFRAME SRC="usagelogs/default.aspx" width="100%" height="200px" id="iframe1" marginheight="0" frameborder="0" onLoad="autoResize('iframe1');"></iframe>


Suppose you want to embed a YouTube video into your post body, you have just to past the URL of the video into the SRC="--------------------" It will automatically adjust the width of the Embedded Content but what you will have to do is that you have to define the height of the embedded content.  So dear, use it to your pages without any problem. 
A Complete Solution for Blogger and Blogging in Google Platform.


This post first appeared on Patronize Blogger And Blogging, please read the originial post: here

Share the post

Adjust width & height of iframe to fit with content in it: Problem solved

×

Subscribe to Patronize Blogger And Blogging

Get updates delivered right to your inbox!

Thank you for your subscription

×