Getting the Size of a Canvas App
The following code example shows how to call the size method to get the size of the canvas app. The console.log function outputs the frame sizes so you can see the sizes change as you resize the canvas app.
// Get the canvas app sizes in the sizes object.
var sizes = Sfdc.canvas.client.size();
console.log("contentHeight; " + sizes.heights.contentHeight);
console.log("pageHeight; " + sizes.heights.pageHeight);
console.log("scrollTop; " + sizes.heights.scrollTop);
console.log("contentWidth; " + sizes.widths.contentWidth);
console.log("pageWidth; " + sizes.widths.pageWidth);
console.log("scrollLeft; " + sizes.widths.scrollLeft);
// Resize the canvas app.
Sfdc.canvas(function() {
sr = JSON.parse('<%=signedRequestJson%>');
Sfdc.canvas.client.autogrow(sr.client);
});