Javascript 当Facebook已被授权时,我如何调用函数?无法调用FB.ui
当Facebook已被授权时,我如何调用函数? 我需要将它传递到另一个基于成功的页面。如果它被授权,我想把它转发给新的jsp。我如何调用该函数?Javascript 当Facebook已被授权时,我如何调用函数?无法调用FB.ui,javascript,facebook,facebook-login,Javascript,Facebook,Facebook Login,当Facebook已被授权时,我如何调用函数? 我需要将它传递到另一个基于成功的页面。如果它被授权,我想把它转发给新的jsp。我如何调用该函数? 我通过Fb.ui了解到我们可以编写回调函数。但是如何调用FB.ui呢?我试过如何调用FB.ui?在FB.init之后添加一个事件侦听器 <div id="fb-root"></div> <script> FB.init({ appId : 'YOUR_APP_ID', // App ID f
我通过Fb.ui了解到我们可以编写回调函数。但是如何调用FB.ui呢?我试过如何调用FB.ui?在FB.init之后添加一个事件侦听器
<div id="fb-root"></div>
<script>
FB.init({
appId : 'YOUR_APP_ID', // App ID from the App Dashboard
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File for x-domain communication
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
FB.Event.subscribe('auth.login', function(response) {
alert('The status of the session is: ' + response.status);
window.location.replace('http://www.NEW_URL.COM/');
});
});
根据您的要求,您可以收听其他与auth相关的活动-请参阅facebook开发者文档以订阅此处的活动:
{
status: "", /* Current status of the session */
authResponse: { /* Information about the current session */
userID: "" /* String representing the current user's ID */
signedRequest: "", /* String with the current signedRequest */
expiresIn: "", /* UNIX time when the session expires */
accessToken: "", /* Access token of the user */
}
}