0
我的代码看起来如下FB登录,jQuery的不工作的铬
$(document).ready(function() {
$.getScript('//connect.facebook.net/en_UK/all.js', function() {
FB.init({
appId: 'XXXXXXXXXXXX',
channelUrl: '//localhost/channel.html',
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true // parse XFBML
});
FB.getLoginStatus(function (response) {
if (response.status === 'connected') {
// the user is logged in and has authenticated your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire
Dosomethinguseful();
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
// but has not authenticated your app
} else {
// the user isn't logged in to Facebook.
FB.login(function (response) {
if (response.session) {
dosomething();
}
});
}
});
});
});
上面的代码工作在Safari和Firefox很大。然而,在铬我没有看到任何事情发生。调试显示没有错误。
需要帮助。
是否有一个使用jquery调用FB auth的工作示例?
===========
试过代码http://geekswithblogs.net/ptahiliani/archive/2013/08/23/facebook-login-authentication-example.aspx。这对铬也不起作用:(。我获得以下错误
'Blocked a frame with origin "http://www.facebook.com" from accessing a frame with origin "https://s-static.ak.facebook.com". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.'
_“调试显示没有错误”_ - 所以你试过什么样的调试措施?你是否尝试按照文档推荐的方式嵌入SDK,而不是getScript mumbo-jumbo? – CBroe
jquery必须这样做,或者如果我udnerstand正确:https://developers.facebook.com/docs/javascript/howto/jquery/ –
啊,不知道FB建议这样做的事情与jQuery结合使用。那么,这留下了问题的第一部分。 – CBroe