Posted on 22 February, 2011 By 66 Comments

How to Remove the Scrollbars from the Facebook Custom Tab Iframe

 

Last week I wrote about how to create a custom Facebook page tab with iframes and said I would discuss the scrollbar issue this week.

The default size for a Facebook tab created with iframes is 520px by 800px. If your page is larger than this, there will be ugly scrollbars on the page.

 

 

When creating the iframe application, make sure that you selected the following on the Facebook Integration section:

  1. Canvas Type – select, you guessed it, iframe.
  2. Iframe size – select auto-resize

Before the ending <body> tag on the html page you created for your iframe, place the following piece of code.

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '142315715832254',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});

window.fbAsyncInit = function() {
FB.Canvas.setAutoResize();
}

</script>

Make sure you change the appID to the ID for the application that you created. You can find that by going to Facebook Developers and clicking on the name of the app in the list of applications on the right side of the page. If it’s the only one you have made, it will be the only one listed. I’ve made quite a few so I have a number of them in my list.

Before the </head> tag on your page, add the following:

<script type="text/javascript">
window.fbAsyncInit = function() {
FB.Canvas.setSize();
}
// Do things that will sometimes call sizeChangeCallback()
function sizeChangeCallback() {
FB.Canvas.setSize();
}
</script>

This pieces of code will solve the scrollbar issues and adjust the frame to size of your page.

If you are still having a scrollbar issue with your iframe page in Internet Explorer, add the following after the <head> tag:

<style type="text/css">
body {
width:520px;
margin:0; padding:0; border:0;
}
</style>

There are a couple of serious bugs related to iframe pages that Facebook says they are working on. I will be discussing these in my next post.

Special thanks to Hyperarts – I figured out the first part of this code but they provided the 2nd part, which was a lingering issue for me.

Tutorial: Add an iFrame Application to your Facebook Fan Page – 2011 Edition
Facebook iFrame Apps – Getting Rid of Those Scrollbars

photo credit: psigrist


StudioPress Premium WordPress Themes

Keep Reading:
Posted In : Facebook

Did you enjoy this article? I can assist you with your WordPress or Facebook project. Contact me and I will provide you with an estimate. You can also connect with me on Facebook or follow me on Twitter. If you are looking for Hosting, WordPress Theme, Newsletter or other recommendations, please view my detailed list.




66 Responses to “How to Remove the Scrollbars from the Facebook Custom Tab Iframe”

Trackbacks/Pingbacks
  1. Facebook iFrames: Opening The Window To Possibility « Social Media «
Leave a Comment
You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .

CommentLuv badge

About

Kim Woodbridge is an accomplished Information and Technical Consultant specializing in the entire implementation of a WordPress based website including installation, theme design, upgrades, unique customizations and ongoing site maintenance.

Recent Comments

    • Chris Tusa: NovelSnippet.com is cool. It contains hundreds of books (and seems to be rapidly growing). The books are accompanied by ...
    • Dee: I drop a leave a response when I especially enjoy a post on a site or I have something to contribute to the conversation...
    • Kabsiha: Thanks for your great idea to hide the deactivated comment link in word press this would be the very useful post for who...
    • Pat Alexander: Well now these are really great. Makes it perfect for small sites....
    • Tracy G: I really don't know how to do it, glad you posted it here....

Wordpress Services

  • Installation, upgrades and maintenance
  • Conversion of existing html and css templates
  • Theme and plugin recommendations
  • CSS customizations
  • Troubleshooting and tweaks for unique situations
  • Customization for individual blogging goals and needs
  • Training and advice