This function is useful when we know our page will resize but don't know when it will happen. A possible scenario is a Canvas application where every page has different height due to variable size of content.
It is very easy to use this function as per facebook documentation. But I faced some issues when I used it in Visual Force pages.
Here is Visual Force Page code to use this feature:
<apex:page>
<body style="overflow: hidden">
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.Canvas.setAutoResize();
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<div style="height:2000px; width:500px; background:blue;">
test page
</div>
</body>
</apex:page>
The main hack is body style="overflow: hidden" which is not documented anywhere but it is required to get a consistent working page in all browser.
You Rock Bro
ReplyDeleteThis is the most useful solution i found so far on scrollbar removal.
Thanks a Lot
Monit
You are the man :-) Thank you very much !
ReplyDeleteThank you! I've been hunting around for an hour trying to get this to work!
ReplyDeletethanks you save my day - This works perfectly for me...
ReplyDeleteGRACIASS LO BUSQUE POR TODO LADOOO !!! EN ESPAÑOL NO HAY UNA EXPLICACION COMO ESTA
ReplyDeletehello
ReplyDeleteyou are all here (as i see) know where to put this code in order that autoresize will work on your facebook app, but i have a facebook app i just created (a minisite iframed in facebook)
and i want that feathure, how and where i do this code???
and how i change aplication url to be under my page as tab??
can someone help please?
thanks
ran
info@ibr.co.il
https://apps.facebook.com/sfghfsdg/