我正在尝试使用JS界面的Facebook API,这是我的第一个应用程序。 这里是一个片段:Javascript FB.api - 未定义的错误
HTML:
<div id="fb-root"></div>
<script src="https://connect.facebook.net/ru_RU/all.js"></script>
<script type="text/javascript">facebook_init();</script>
JS:
function facebook_init() {
FB.init({
appId : '<MY APP ID IS HERE>',
channelUrl : '/media/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.api('/me', function(response) {
alert('Your name is ' + response.name);
});
}
channel.html:
<script src="https://connect.facebook.net/ru_RU/all.js"></script>
我 '你的名字是未定义' 当我加载这一页。 但是,此代码
FB.ui({ method: 'apprequests',
message: 'MSG',
title: 'TITLE'});
按预期工作。 你能帮我吗? 谢谢!