Search code examples
facebookfacebook-iframefacebook-apps

Remove horizontal and vertical scrollbar from facebook apps


I have created a facebook apps. It works fine for me. But my problem is that always show vertical and horizontal scrollbar, when I use fluid for both width and height of my page from facebook settings. My page looks like this http://karen.webmascot.com/fb/fbone.jpg. What can I do now?


Solution

  • Set scroll=no and overflow:hidden to your body and use FB.Canvas.setAutoGrow() to remove the scrollbar.

    <body scroll="no" style="overflow:hidden">
    <div id="fb-root"></div>
    <script type="text/javascript">
    window.fbAsyncInit = function () {
        window.setTimeout(function () {
            FB.Canvas.setAutoGrow()
        }, 250)
    };
    (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>