JS API M FB.Init

From Facebook Developer Wiki

Jump to: navigation, search

public static void init (string apiKey, string xdChannelUrl, object appSettings)

Description

This safely initializes the Facebook API for use on a Connect site or iframe application. This method loads required features and then calls the JS_API_M_FB.Facebook.Init_2 method.

In a typical Facebook Connect application, this method should be the first Facebook API call to make.


Parameters

RequiredNameTypeDescription
required apiKey string Your application or site's API key.
xdChannelUrl string The URL to your cross domain communication channel file.
appSettings object A dictionary of application settings. Currently supported key/value are:
  • 'reloadIfSessionStateChanged': bool -- If the value is true, we will monitor changes in session state and reload current page if session state changes. This option is convenient for application that needs to reload page whenever session state change in order to generate different content from server side.
  • 'ifUserConnected': 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. Note this key and 'reloadIfSessionStateChanged' cannot be specified at the same time.
  • 'ifUserNotConnected': 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 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. Note this key and 'reloadIfSessionStateChanged' cannot be specified at the same time.
  • 'doNotUseCachedConnectState': bool -- By default, we check cookie for cached connect state. If this value is true, we will clear cached cookie value and not use it.
  • 'debugLogLevel': int -- Specify debug logging level. This is same as setting FB.FBDebug.logLevel


Back to class public sealed FB.Bootstrap

reference