Eliminating Facebook App Scroll Bars

Facebook makes it difficult to remove scroll bars from an App iFrame. Here is how I did it.

<script type="text/javascript">
FB.init({
appIdĀ  : '<?php echo $app_id; ?>',
});
function setHeight(height){
var pix_height = height * 55 + 225 + 50;
FB.Canvas.setSize({height: pix_height });
}
</script>

I was posting a table, so I estimated what each row required, 55 pixels, what the header required: 225 pixels, and the 50 pixels of safety. Then, when I was done generating the content (using jquery), I called setHeight(num_of_rows) and away it went.

Leave a Reply

Your email address will not be published. Required fields are marked *