Dimensions

The Dimensions object is a JSON-formatted object containing context information about dimensions of the iFrame on which the canvas app appears.

FieldDescription
clientHeightThe values of clientHeight are sent to the canvas app within SignedRequest and can be used to set the height of the outermost div element. This field is useful for setting the height of an app that’s accessed from a mobile device. The field can be referenced as sr.context.environment.dimensions.clientHeight, where sr is the parsed signed request JavaScript object.
clientWidthThe values of clientWidth are sent to the canvas app within SignedRequest and can be used to set the width of the outermost div element. This field is useful for setting the width of an app that’s accessed from a mobile device. The field can be referenced as sr.context.environment.dimensions.clientWidth, where sr is the parsed signed request JavaScript object.
heightThe height of the iFrame in pixels.
widthThe width of the iFrame in pixels.
maxHeightThe maximum height of the iFrame in pixels. Defaults to 2,000; “infinite” is also a valid value.
maxWidthThe maximum width of the iFrame in pixels. Defaults to 1,000; “infinite” is also a valid value.

The following code snippet shows an example of the Dimensions object.

1"dimensions": 
2{ 
3
4    "clientHeight": "50px", 
5    "clientWidth": "70px", 
6    "height": "900px", 
7    "width": "800px", 
8    "maxHeight": "2000px", 
9    "maxWidth": "1000px" 
10},

See Also