Facebook Wiki
Definitely read
this page on the Facebook Wiki.
FB.Init Application Settings
The FB initialization method takes some optional settings that can call javascript functions or make URL requests or reload the page depending on the connected status.
This isn't dynamic, but only happens on page load.
Read more.
Cookies
It's interesting to look at the
Debug Splat
to see what cookies are (or are not) set for the various connect states.
Here's what I've learned while watching that pager. Replace "12345" below with your API_KEY"
- When connected the following cookies are set (where "12345" is the API_KEY): 12345, 12345_expires, 12345_session_key, 12345_ss, 12345_user
- When connected the cookie 'fbsetting_12345' is set and contains a JSON value with some interesting keys. Most interesting is 'connectState'.
- When connected 'connectState' is set to 1.
- If connected, but also logged out of Facebook (in another tab say) after a second or two (and a page reload) 'connectState' is set to 2.
- It might be reasonable to periodically check the value of this client side and if it changes act on it.
Javascript
Facebook provides a 'FB.Connect.get_status()' method which returns an object,
whose 'result' attribute indicates the connected status. A status of 1 means
the user is connected. A status of 2 means disconnected. See how the value
changes depending on whether you are logged in or out (top right of page).
Click here to see the status in the box below.
Comments