FB.Canvas.setSize

From Facebook Developer Wiki (FbDevWiki.com)
Jump to: navigation, search

Tells Facebook to resize your iframe.

Examples

Call this whenever you need a resize. This usually means, once after pageload, and whenever your content size changes.

window.fbAsyncInit = function() {
  FB.Canvas.setSize();
}

// Do things that will sometimes call sizeChangeCallback()

function sizeChangeCallback() {
  FB.Canvas.setSize();
}

It will default to the current size of the frame, but if you have a need to pick your own size, you can use the params array.

FB.Canvas.setSize({ width: 640, height: 480 }); // Live in the past

The max width is determined by the placement of the iframe within Facebook, and there is no max height.

Parameters

Name Type Description
params Object
Property Type Description Argument Default Possible Values / Examples
width Integer Desired width in pixels Optional current frame width
height Integer Desired height in pixels Optional current frame height
Personal tools
Namespaces
Variants
Actions
Navigation
Graph API
FQL
Toolbox