나는 badgeville을 사용하여 플레이어에게 포인트를주는 페이 스북 앱을 작성하고 있습니다. 때때로 포인트는 페이지가로드 될 때 수여되어야하지만, 코멘트 상자와 같은 버튼과 같은 페이지에 페이스 북 소셜 플러그인이 있습니다. 페이지가로드되기를 기다리고 있기 때문에 포인트를 올바르게 부여하는 기능을 허용하기 위해 badgeville 자료를로드하지 않습니다.페이스 북의 로딩이 완료되면 자바 스크립트 기능 실행
페이스 북이 일을 마치면 기능을 실행하는 데 사용할 수있는 이벤트가 있습니까? "FB.Canvas.setDoneLoading();"이 발견되었습니다. 하지만 그것을 구현하는 방법을 잘 모르겠습니다. FB 기능이 초기화 설정 될 때까지이 setDoneLoading()가 호출되지 않았는지 확인합니다
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR APP ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : 'http://www.yourdomain.com/channel.html', // Custom Channel URL
oauth : true //enables OAuth 2.0
});
FB.Canvas.setDoneLoading(
function() {
alert("Done loading");
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
: