FB.Connect.ifUserConnected

Description

Use this function to take action depending on whether the user has already connected with your application.

On page load, the JavaScript library will ping Facebook to determine if the user is currently logged in, and if so, if they have already authorized your application. When the response comes back, then it will invoke the correct callback - either connectedArg or notConnectedArg.

For performance reasons, the Connect state is sometimes cached in a cookie on your domain, so that there is not a delay between page clicks. This means that the state may be recalculated after one of the callbacks has already been called - for example, if the user logs out of Facebook in between page clicks.

Your callbacks must be idempotent, since they could be called multiple times during the page operation, if session state is updated.

Signature

ifUserConnected(Object connectedArg,  Object notConnectedArg)

Parameters

connectedArgObject

This parameter can be either a function that takes a string argument for uid or string to a url. If a function is passed, then the function would be invoked if the user is connected. If a string is passed, then the browser will be redirected to the url specified in the string if the user is connected.

notConnectedArgObject

This parameter can be either a function or string to a url. If a function is passed, then the function would be invoked if the user is not connected. If a string is passed, then the browser will be redirected to the url specified in the string if the user is not connected.