Loading Control

The method 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 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

NameTypeRequiredDescription

callback

Function

no

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

Returns

This function returns an object with a single property, time_delta_ms.

PropertyTypeDescriptionArgument

time_delta_ms

Integer

Load time, in milliseconds.

Required