5

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?

Hafiz
  • 4,187
  • 12
  • 58
  • 111

2 Answers2

8

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.

Elad Lachmi
  • 10,406
  • 13
  • 71
  • 133
  • Yes you are right and I have now already fixed that, anyways thanks – Hafiz Mar 01 '11 at 06:05
  • 2
    Just adding that [the documentation](https://developers.facebook.com/docs/reference/javascript/FB.Canvas.setAutoResize/) suggests using `FB.Canvas.setAutoGrow` instead because `FB.Canvas.setAutoGrow` is going to be removed. – RCE Dec 13 '11 at 09:22
5

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

Alsemany
  • 445
  • 1
  • 5
  • 13
  • You are welcome any way we found just a bug using this function http://developers.facebook.com/docs/reference/javascript/fb.caNvas.setautoresize/ you just try to put this function at the end of your page to be active – Alsemany Mar 02 '11 at 23:28