Newer Version Available
Automatically Resizing a Canvas App
The following code examples show how to call the autogrow method to resize a canvas app. Use this method when your content will change size, but you’re not sure when.
1// Turn on auto grow with default settings.
2Sfdc.canvas(function() {
3 sr = JSON.parse('<%=signedRequestJson%>');
4 Sfdc.canvas.client.autogrow(sr.client);
5});
6
7// Turn on auto grow with polling interval of 100ms (milliseconds).
8Sfdc.canvas(function() {
9 sr = JSON.parse('<%=signedRequestJson%>');
10 Sfdc.canvas.client.autogrow(sr.client, true, 100);
11});
12
13// Turn off auto grow.
14Sfdc.canvas(function() {
15 sr = JSON.parse('<%=signedRequestJson%>');
16 Sfdc.canvas.client.autogrow(sr.client, false);
17});