JavaScript

FB.Canvas.getPageInfo

Updated: Mar 1, 2018
Copy for LLM
Returns a Javascript object containing information about your app's canvas page. You need to provide a callback with the API, where we fetch the new value and return it.
Since a Canvas app runs in an iframe it does not have access to window.innerHeight and window.innerWidth. This method exists to provide access to the client (browser) dimensions as well as the current scroll position and offset coordinates.

Examples

FB.Canvas.getPageInfo(
function(info) {
alert('Width: ' + info.clientWidth + ' Height: ' + info.clientHeight);
}
);

Returns

Name Type Description
clientHeight
Integer
The height of the viewport in pixels
clientWidth
Integer
The width of the viewport in pixels
offsetLeft
Integer
The number of pixels between the left edge of the viewport and the left edge of your app’s iframe
offsetTop
Integer
The number of pixels between the top edge of the viewport and the top edge of your app’s iframe
scrollLeft
Integer
The number of pixels between the left edge of your iframe and the left edge of your iframe’s viewport
scrollTop
Integer
The number of pixels between the top edge of your iframe and the top edge of your iframe’s viewport

Parameters

Name Type Required Description
callback
Function
no
Function called back with the app canvas info.