检查用户是否登录到Facebook [英] Check if a user is logged in to 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屋!