Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
  • SDK Reference
    • JavaScript SDK
    • PHP SDK
    • iOS SDK
    • Android SDK
  • Tools
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.getSession
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML Methods
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.getPageInfo
    • FB.Canvas.hideFlashElement
    • FB.Canvas.scrollTo
    • FB.Canvas.setAutoGrow
    • FB.Canvas.setDoneLoading
    • FB.Canvas.setSize
    • FB.Canvas.setUrlHandler
    • FB.Canvas.showFlashElement
    • FB.Canvas.startTimer
    • FB.Canvas.stopTimer

FB.Canvas.getPageInfo

SDK Reference › JavaScript SDK › FB.Canvas.getPageInfo

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.

As a Canvas app runs within 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);
    }
);

Return

NameTypeDescription
clientHeightInteger

The height of the viewport in pixels

clientWidthInteger

The width of the viewport in pixels

offsetLeftInteger

The number of pixels between the left edge of the viewport and the left edge of your app's iframe

offsetTopInteger

The number of pixels between the top edge of the viewport and the top edge of your app's iframe

scrollLeftInteger

The number of pixels between the left edge of your iframe and the left edge of your iframe's viewport

scrollTopInteger

The number of pixels between the top edge of your iframe and the top edge of your iframe's viewport

Parameters

NameTypeDescription
callbackFunction

Function called back with the app canvas info.

Updated about 3 months ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy