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.
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17// Turn on auto grow with default settings.
18Sfdc.canvas(function() {
19 sr = JSON.parse('<%=signedRequestJson%>');
20 Sfdc.canvas.client.autogrow(sr.client);
21});
22
23// Turn on auto grow with polling interval of 100ms (milliseconds).
24Sfdc.canvas(function() {
25 sr = JSON.parse('<%=signedRequestJson%>');
26 Sfdc.canvas.client.autogrow(sr.client, true, 100);
27});
28
29// Turn off auto grow.
30Sfdc.canvas(function() {
31 sr = JSON.parse('<%=signedRequestJson%>');
32 Sfdc.canvas.client.autogrow(sr.client, false);
33});