Full height of Facebook app Canvas in iframe

20.2k Views Asked by At

I am having problem that I am developing a facebook app using iframe, the problem that is coming is that my full content is not being displayed . When I inspect it through firebug then I came to know that iframe is having height: 800px so I want to increase it or set height dynamically. I have tried FB.Canvas.setSize() but it didn't work so what should I do?

2

There are 2 best solutions below

2
On BEST ANSWER

In the developer app on Facebook go to the app and edit settings. In the Facebook integration section you can set "IFrame size" to auto-resize. Then in your app, call FB.Canvas.setAutoResize after FB.init and the canvas should resize itself to fit your content automatically.

1
On

just go to your application settings change to auto resize

and use the function FB.Canvas.setAutoResize

as this code

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

 FB.Canvas.setAutoResize(7);

 </script>



<?php


for($i=1;$i<100;$i++)
 {

  echo "$i<br>";

  }
  ?>

this will make 99 lines with autoresize