Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Media
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • Web
    • Getting Started
    • JavaScript SDK
    • PHP SDK
    • More SDKs
    • Facebook for WordPress
  • Technology Partners
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.hideFlashElement
    • FB.Canvas.scrollTo
    • FB.Canvas.setAutoGrow
    • FB.Canvas.setDoneLoading
    • FB.Canvas.setSize
    • FB.Canvas.setUrlHandler
    • FB.Canvas.showFlashElement
    • FB.Canvas.startTimer
    • FB.Canvas.stopTimer

FB.init

Web › JavaScript SDK › FB.init

Overview

After loading the JavaScript SDK, call FB.init to initialize the SDK with your app ID. This will let you make calls against the Facebook API.

If you're using the SDK alongside jQuery or RequireJS, the following guides may be useful:

  • Using the Facebook SDK for JavaScript with jQuery
  • Using the Facebook SDK for JavaScript with RequireJS

Note: All FB.API methods must be called after FB.init.

Parameters

NameTypeRequiredDescription
optionsObjectyes

See Options below

Options

Property Type Description Argument Default
appId String Your application ID. Optional null
cookie Boolean true to enable cookie support. Optional false
logging Boolean false to disable logging. Optional true
status Boolean true to fetch fresh status. Optional true
xfbml Boolean true to parse XFBML tags. Optional false
channelUrl String Specifies the URL of a custom URL channel file. This file must contain a single script element pointing to the JavaScript SDK URL. Optional null
authResponse Object Manually set the object retrievable from getAuthResponse. Optional true
frictionlessRequests boolean see Frictionless Requests Optional false
hideFlashCallback Object see Custom Flash Hide Callback Optional null
Updated about a week ago
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy