FB.Canvas.scrollTo Doesn't work inside iframe on Facebook tab

I would like to have a "go to top" link in an iFrame tab in the new Facebook timeline, tried using FB.Canvas.scrollTo as follows, but didn't work. Any pointers are eagerly appreciated!

<body style="overflow: hidden">
<div id="fb-root"></div>
  // Load the SDK Asynchronously
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);

  // Init the SDK upon load
  window.fbAsyncInit = function() {
      appId      : 'myAppID', 
      channelUrl : 'my_channel.html', 
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML

 document.getElementById('go_to_top').addEventListener('click', function(){

  <div id="goToTop">
     <img border=0 src ="aPicForClicking.jpg">



source to share

2 answers

I had the same problem. In application settings, set Canvas Height to Fixed.
Then FB.Canvas.scrollTo (0,0) works fine;



Canvas does not throw an error, but also fails when the iframe is inside the content of another iframe.

IE. nested iframes are not supported for API calls.



All Articles