Wednesday, 20 April 2011
IFrame Code Samples
Do you like this story?
Do you want to know how to code an IFrame
in Facebook? This section explains the ‘how
to’s.”
Working with the Facebook API, you can set up IFrames in a FBML applicaiton or in an IFrame application.
The following example works in an FBML application. This will not work in an IFrame application becase HTML will not expand the FB tags.
Example of working code for an FBML application:
<hr/>
<a onClick="outside_location.setInnerFBML(location_two);" style="cursor: pointer;">Other IFrame Location</a>
<div id="outside_location" width="540" height="270" >
<fb:iframe width="540" height="270" frameborder="1" src="http://www.yahoo.com" />
</div>
<fb:js-string var="location_two">
<fb:iframe width="540" height="270" frameborder='1' src='http://www.google.com' />
</fb:js-string><script type="text/javascript" charset="utf-8">
var outside_location = document.getElementById('outside_location');
</script>
</code>
which results in this:
If you want to embed an IFrame directly in your application canvas, you can just use code like this:
<fb:iframe width="720" height="570" frameborder="1" src="http://www.yahoo.com" />
To programmatically add iframes in Facebook you can use JavaScript like so:<script type="text/javascript">var Iframe = document.createElement('iframe');
Iframe.setStyle('smartsize','true');
Iframe.setStyle('frameborder','yes');
Iframe.setStyle('scrolling','no');
Iframe.setStyle('include_fb_sig','true');
Iframe.setStyle('width','500px');
Iframe.setStyle('height','500px');
Iframe.setSrc("http://www.msn.com");
document.getRootElement().appendChild(Iframe);</script>
This post was written by: kashif
For Suggestions and complains email us at pakcompany@yahoo.comTwitter
Subscribe to:
Post Comments (Atom)
0 Responses to “IFrame Code Samples”
Post a Comment