Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
  • SDK Reference
    • JavaScript SDK
    • PHP SDK
    • iOS SDK
    • Android SDK
  • Tools
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.getSession
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML Methods
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.getPageInfo
    • 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

SDK Reference › JavaScript SDK › 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 about 8 months ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy