1

Possible Duplicate:
Check if user is logged in New Facebook API

ive implemented facebook login intergration within my site. everything works as should. except that, i want a script to know if someone is logged into facebook, to have the option to autologin. lemme give you a better example, go to http://bit.ly/iaUiEf when logged into facebook. it will popup this feature. is this an fb feature?

Community
  • 1
  • 1
Sir Lojik
  • 1,409
  • 7
  • 24
  • 45
  • http://stackoverflow.com/questions/3348543/check-if-user-is-logged-in-new-facebook-api Isn't this basically the same question? – qeek Jan 29 '11 at 21:42
  • no its not, ive successfully done what that user was asking, now im inquring about that autologin popup on that link – Sir Lojik Jan 29 '11 at 21:44

1 Answers1

1

You can use HTTP Headers to see if a user is logged in to Facebook, via Javascript as explained by this post

<script type="text/javascript"
        src="https://www.facebook.com/imike3"
        onload="logged_in_to_facebook()"
        onerror="not_logged_in_to_facebook()"
        async="async"
></script>

See the linked post to see the whole explanation. But briefly, using a script tag.. the user's browser is asked to fetch a certain profile page. That profile page's permissions is setup so that only logged in users in facebook will be able to see it. Thus, return with a Status 200 and triggers the onload event. Even though the page does not contain valid Javascript, the browser will just ignore it.

Arvin
  • 2,272
  • 14
  • 10