Monday, October 10, 2011

Facebook–how to set the height of your tab

Today I had to set to more than 800 pixels the height of my tab. I found here a simple solution, thanks a lot to Amit Jain.

Steps in brief:

  1. in the app “canvas settings” set the height to “Settable”, like in the image shown below.
  2. add to the <body> line: style="overflow: hidden" (to remove the scrollbars)
  3. add to your main <div> (the one that contains your html) the style: style="height:2000px; width:520px;" – obviously you will set your desired height
  4. finally, just below the <body> tag, add this code:

<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>
 

that’s it – worked for me!

2011-10-10_1630

No comments: