Full height of Facebook app Canvas in iframe
Asked Answered
N

2

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?

Nieberg answered 27/2, 2011 at 21:39 Comment(0)
S
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.

Sleeper answered 1/3, 2011 at 5:12 Comment(2)
Yes you are right and I have now already fixed that, anyways thanksNieberg
Just adding that the documentation suggests using FB.Canvas.setAutoGrow instead because FB.Canvas.setAutoGrow is going to be removed.Tricyclic
S
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

Susi answered 1/3, 2011 at 22:8 Comment(1)
You are welcome any way we found just a bug using this function developers.facebook.com/docs/reference/javascript/… you just try to put this function at the end of your page to be activeSusi

© 2022 - 2024 — McMap. All rights reserved.