2

I created a facebook iframe page tab which is link to my website. The problem is when I scroll down within the iframe to view the content and click on the next page, it would load but the page will be aligned just as the previous page so that I have to scroll upwards.

How do I fix it so that when I click on the next page, the new page would aligned from the top and not aligned as the previous page in iframe?

I research for hours and heard that the following code will help solved it, but I don't know how to code it.

FB.Canvas.scrollTo(0,0);

How do you code it so that it would load the javascript SDK and FB.Canvas.scrollTo(0,0);?

Is there another option to fix this?

Kao Yang
  • 21
  • 1
  • 3

2 Answers2

4
window.fbAsyncInit = function() {
    FB.init({
        appId : 'app_id',
        status : true, // check login status
        cookie : true, // enable cookies to allow the server to access the session
        xfbml : true // parse XFBML
    });
    FB.Canvas.setAutoGrow(200);
    FB.Canvas.scrollTo(0,0);
}
Nikola K.
  • 7,093
  • 13
  • 31
  • 39
senthilbp
  • 807
  • 1
  • 9
  • 16
-1

This is the full script you need.

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

If you have further questions, read this tutorial - http://ftutorials.com/scroll-to-top/

webtech
  • 311
  • 3
  • 13