Prefetching Mode

The method FB.Canvas.Prefetcher.setCollectionMode() controls how statistics are collected on resources used by your application. This method influences whether those resources are fetched to the browser early; it can also be used to turn off Prefetching completely.

This method takes one of two constants as a parameter:

  • FB.Canvas.Prefetcher.COLLECT_AUTOMATIC -- use default collection mode
  • FB.Canvas.Prefetcher.COLLECT_MANUAL -- fully manual

See the Prefetching section for an overview of this feature.

Examples

To completely control which resources are reported to Facebook, for a given page load

FB.Canvas.Prefetcher.setCollectionMode(FB.Canvas.Prefetcher.COLLECT_MANUAL);
FB.Canvas.Prefetcher.addStaticResource("http://www.mydomain.com/foo.js");
// ...

Note

It is not necessary to call setCollectionMode to call addStaticResource; in automatic mode, Facebook will automatically infer what other resources you are using that are important to fetch early.

You can use the staticresources connection on the Graph API Application object to check which usage statistics are being collected.