Safari中的Facebook JavaScript API错误:TypeError:'undefined'不是一个对象(评估'b.fbCallID = a.id')
问题描述:
从我大约一周前(切换到OAuth 2.0,我相信)在包含http://connect.facebook.net/en_US/all.js的Safari中加载页面时出现以下错误。Safari中的Facebook JavaScript API错误:TypeError:'undefined'不是一个对象(评估'b.fbCallID = a.id')
TypeError: 'undefined' is not an object (evaluating 'b.fbCallID=a.id')
我的标记和JavaScript如下:
<fb:login-button scope="email">Login with Facebook</fb:login-button>
$(function() {
FB.init({
appId: '12345',
cookie: true,
status: true,
xfbml: true
});
FB.login(function(response) {
if (response.authResponse) {
document.cookie = 'access_token=' + response.authResponse.accessToken;
window.location.reload();
}
});
});
这以前工作的罚款,并预期在Chrome仍然是工作。有没有人看过这个?在此先感谢您的帮助。
答
我能够通过改变FB.login
调用下面来解决这个问题:
FB.Event.subscribe('auth.login', function(response) {
if (response.authResponse) {
document.cookie = 'access_token=' + response.authResponse.accessToken;
window.location.reload();
}
});