With method FB.Canvas.Prefetcher.addStaticResource()
you can inform the Facebook Canvas system that the current page uses a static resource, for example a JavaScript file. Adding static resources via this method can help the resource to be prefetched to the browser to improve performance.
FB.Canvas.Prefetcher.addStaticResource("http://www.mydomain.com/foo.js");
object
, link
, and script
tags that reference Flash, Javascript, and CSS files. If your static resource is one of these types, but is not referenced from the DOM, you can call this function to schedule it for prefetching.The resource must properly return the following HTTP headers when requested by the client (if the headers are specified at all):
application/x-shockwave-flash
, application/x-compress
, text/css
, application/javascript
, and application/x-javascript
. If the content is not one of these types, the resource will be ignored.no-cache
, no-store
, or private
, the resource will be ignored.You can use the staticresources
connection on the Graph API Application object to verify that resources you are adding are getting counted.