I need to know if the users of my website has logged to facebook in the past 30 days开发者_如何学Python.
Can I know this through facebook cookies or in another way ?
Create a <form>
that asks
- "Do you have a facebook account?"
- "If yes, have you logged into it in the last 30 days?"
Edit: This is an interesting post on Abusing HTTP Status Codes to Expose Private Information
You will not be able to check whether the user has logged into Facebook any time. What you can do is leverage the CSS history hack to see whether the user has visited Facebook.
But that would still be kind of unethical...
You could try checking the Facebook Developer Tools for website integration.
Answering your title question - actually it is possible to know if a user has facebook account, but only if he/she is logged in into facebook right now (even for those that never authorized your app before). You can do this by calling FB.getLoginStatus()
and checking returned status. If it equals to notConnected
- user is logged in into facebook right now.
You cannot read cookies from "other" sites. Actually you cannot read any cookies at all. The client/browser is sending you the cookies with their values. And they have no reason to send cookies to a web server which are associated to a total different site. If you want to know if a user have login into facebook you have to asked the facebook servers (if they have such an API and if you know the username)
No - even if you knew their Facebook ID, had their email address, the user granted you every single extended permission, and also knew the user's favorite color and the names of all their pets, you still would not be able to determine what you're asking for.
精彩评论