I have an app that uses the Javascript SDK and the height is being determined initally through FB.Canvas.setSize();. This is working correctly:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '223615011031939',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
// channelUrl : 'http://www.yourdomain.com/channel.html', // Custom Channel URL
oauth : true //enables OAuth 2.0
});
FB.Canvas.setSize();
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
But say there is content on the page that would expand, making the height larger than the set iFrame size after init. I tried using FB.Canvas.setAutoGrow(); with various parameters passed through it, but it would give me a refresh loop and expand the height by a little but each time.
So my question is, how do I get the setAutoGrow function to work apporpriately, resizing the iFrame only when the content grows and not at set intervals? If it only can be on set intervals, only refresh when the content actually grows.
Thanks again in advance!
Refer to this page:
https://developers.facebook.com/docs/reference/javascript/FB.Canvas.setAutoGrow/
“This function is useful if you know your content will change size, but you don’t know when. There will be a slight delay, so if you know when your content changes size, you should call setSize yourself (and save your user’s CPU cycles).”
So, if you have some javascript functions that increase the height you can call the setSize method, otherwise setAutoGrow and specify a longer or shorter interval