我在头部有这样的代码:
<script src="http://connect.facebook.net/en_US/all.js"></script>
然后我有以下这段FB登录按钮代码:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=myAppId&xfbml=1">
</script><fb:login-button show-faces="false" perms="user_hometown,user_about_me,email,user_address"
autologoutlink="true" width="200" max-rows="1">
</fb:login-button>
当用户使用FB按钮登录后,我该如何进行JS调用以获取他们的姓名、电子邮件、照片等信息呢?
我还发现了一些类似以下代码的内容,但不确定这在哪里使用:
<script>
FB.init({
appId : 'myAppId',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelURL : 'http://www.comehike.com/channel.html', // channel.html file
oauth : true // enable OAuth 2.0
});
</script>
我需要写在上面的代码吗?
谢谢!
FB.init
代码来初始化Facebook JavaScript SDK并解析XFBML。 - jBit