2012-03-29 3 views
3

새 Facebook 타임 라인에서 iFrame 탭 페이지 내에 "go to top"링크를 갖고 싶습니다. 다음과 같이 FB.Canvas.scrollTo를 사용하려고했습니다. 하지만 작동하지 않습니다. greated 모든 포인터 감사!FB.Canvas.scrollTo Facebook 탭 페이지의 iframe에서 작동하지 않습니다.

<body style="overflow: hidden"> 
<div id="fb-root"></div> 
<script> 
    // Load the SDK Asynchronously 
    (function(d){ 
    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); 
    }(document)); 

    // Init the SDK upon load 
    window.fbAsyncInit = function() { 
    FB.init({ 
     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(){ 
     FB.Canvas.scrollTo(0,0); 
    }); 

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

답변

7

나는 동일한 문제가있었습니다. 응용 프로그램 설정에서 캔버스 높이를 고정으로 설정합니다.
그런 다음 FB.Canvas.scrollTo (0,0)가 정상적으로 작동합니다.

+0

팁 주셔서 감사합니다! (+! 아직까지는 충분한 평판이 없다.) – Hofuzz

0

캔버스는 오류를 발생시키지 않지만 iframe이 다른 iframe의 콘텐츠 내에있는 경우에도 작동하지 않습니다.

IE. 중첩 된 iframe은 API 호출에 지원되지 않습니다.

관련 문제