检查用户是否登录到Facebook [英] Check if a user is logged in to Facebook

查看:106
本文介绍了检查用户是否登录到Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图检查用户是否登录到Facebook(刚刚登录或不与我的应用程序无关)使用javascript。

我尝试在FB之后使用以下代码。 init:

FB.getLoginStatus(function(response){

alert(response.status);

}); code>

edge.create正常工作。

I'm trying to check whether a user is logged in to Facebook (just logged in or not, with no relation to my application) using javascript.
I tried using the following code after FB.init:
FB.getLoginStatus(function(response) {
alert(response.status);
});

edge.create is working just fine though.

推荐答案

有一些黑客这可以帮助,但不是在你的情况。 https://grepular.com/Abusing_HTTP_Status_Codes_to_Expose_Private_Information

There are some hacks that can help, but not in your situation. https://grepular.com/Abusing_HTTP_Status_Codes_to_Expose_Private_Information

这是一个简单的例子:

<html> 
<head> 

</head>

<body>
// At the end of page will be good 
<script>
function logged() {
    alert('logged');
}
function notlogged() {
    alert('not logged');
}
</script>
<script src="http://www.facebook.com/ajax/composer/attachment/question/question.php" onload="logged()" onerror="notlogged()">
</body> 
</html> 

这篇关于检查用户是否登录到Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆