Graph API Version

Facebook SDK for JavaScript - Reference

Reference docs for each of the full list of methods and functions available in the SDK.

Core Methods

Method Description


Used to initialize and setup the SDK. All other SDK methods must be called after this one.


Make an API call to the Graph API.


Used to trigger different forms of Facebook created UI dialogs, such as the Feed dialog, or the Requests dialog.

Facebook Login Methods

Method Description


Returns the Facebook Login status of a user, with an authResponse object if they are logged in.


Prompts a user to login to your app using the Login dialog in a popup. This method can also be used with an already logged-in user to request additional permissions from them.


Used to logout the current user both from your site or app and from


When your app is able to assume that a user is definitely logged-in via Facebook, this synchronous method can return the authResponse object without the overhead of an asynchronous call.

Event Handling Methods

Method Description


Subscribe to a JavaScript event, which will fire on various different types of actions, such as someone clicking a Like button, or adding to a Comments Box.


Remove any event subscriptions that were previously created.

App Events

This Facebook SDK (JS) App Events API has been deprecated and is no longer supported starting July 1, 2022. There are no plans to add new features to this product.

Instead of using FB.AppEvents.LogEvent, we recommend that you send these events through the Meta Pixel.

Method Description


Log an application event, for example when someone completes your tutorial.


When someone makes a purchase in your app, log the event.


Log when app launches.

XFBML Methods

XFBML is a markup language like HTML, with special tags that are used to insert social plugins into HTML pages.

Method Description


Parses and renders any XFBML on a page. This can be useful if you insert any social plugins into the DOM after the initial page load, or you set xfbml as false in FB.init().

Canvas Methods

These methods can only be used by Apps on that run in a Canvas page.

Method Description


Controls which static resources are flushed to the browser early.


Controls how statistics are collected on resources used by your application, with the intent to influence whether those resources will be fetched to the browser early, or to turn off Prefetching completely.


Tells Facebook to scroll to a specific location in the iframe of your canvas page.


Starts or stops a timer which resizes your iframe every few milliseconds.


Tells Facebook to resize your iframe.


Registers the callback for inline processing (i.e. without page reload) of user actions, such as clicks on Live Ticker game stories.


Reports that the page is now usable by the user, for collecting performance metrics.


When using .setDoneLoading(), controls the page load timer.


When using .setDoneLoading(), controls the page load timer.