Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • JavaScript
    • Getting Started
    • How-Tos
    • Reference
  • PHP
  • More SDKs
  • 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.Canvas.setDoneLoading

JavaScript › Reference › FB.Canvas.setDoneLoading

Calls you back with an integer, in milliseconds, of the timing of the page load, beginning from the time when the first bytes arrive on the client, and ending from the point at which you call this function.

The point at which you call it is up to you; in general, choose a point at which the user will be able to interact meaningfully with your application.

If you call this function, your application's page load performance over time will appear in the Performance tab of your application's Insights Dashboard.

If you want to exclude certain parts of the page load, use stopTimer and startTimer. These methods will stop and start the load timer respectively.

Examples

To simply report when your application is ready, call

FB.Canvas.setDoneLoading();

To use that information yourself, specify a callback. Here we pop up a dialog to display the application load time.

FB.Canvas.setDoneLoading(
  function (result) {
    alert(result.time_delta_ms);
  }
);

Parameters

NameTypeDescription
callbackFunction

(optional) A function called back with the page load time.

Updated over a year ago
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy