26-10-2011

Javascript Open an iframe and set source with JavaScript

Often when you want to display content from remote sites or applications seamlessley on your own site, an iframe is the quickest and easiest solution. Here's how you open one using JavaScript:

<div id="feed"></div>
<script>
	var ifrm = document.createElement('iframe');
	ifrm.width = '460px';
	ifrm.height = '80px';
	ifrm.src = 'http://someremoteurl.com/';
	ifrm.frameBorder = 0;
	ifrm.scrolling = "no";
	document.getElementById('feed').appendChild(ifrm);
</script>
Keywords: iframe

Comments:

Your comment:

»
Khan 03/12/2012, 10:37 am
It's look like very lengthy process i am looking for something which is short

 

[x]