Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • JavaScript
  • 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.stopTimer

To be used in conjunction with setDoneLoading. Call stopTimer when you wish to stop timing the page load for a period of time, such as when you are waiting for the user to click a button on an interstitial page. Follow it by startTimer to restart the timer and then setDoneLoading when the page load is complete.

If you specify a callback function, it will be called 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.

Examples

To stop the timer, do

FB.Canvas.stopTimer();

you'll need to call startTimer before calling setDoneLoading.

To get the time elapsed so far, specify a callback. Here we pop up a dialog to display the load time so far.

FB.Canvas.stopTimer(
    function (result) {
        alert("Blocked on user input after " + result.time_delta_ms + " milliseconds");
    }
);

Parameters

NameTypeDescription
callbackFunction

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

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