Pages

Wednesday, May 18, 2011

Remove scroll bars from facebook iframe application

Step 1: Make "IFrame Size" to "Auto-resize" on the application settings page.

Step 2: Insert below code just before closing the head tag ( </head> ) on the child page.

<script type="text/javascript">
window.fbAsyncInit = function() {
FB.Canvas.setSize();
}
// Do things that will sometimes call sizeChangeCallback()
function sizeChangeCallback() {
FB.Canvas.setSize();
}
</script>


Step 3: Insert the below code just before closing body tag ( </body> ).


<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : 'YOUR-APP-ID-HERE',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>

** Please make sure to put your appid correctly.

1 comment: