3

In our canvas App, we have the following code, where sfsrjson is the signed request JSON:

<script type="text/javascript">
    Sfdc.canvas(function() {
        Sfdc.canvas.client.resize(sfsrjson.client);
        Sfdc.canvas.client.autogrow(sfsrjson.client);
    });
</script>

We have a page that is configurable by the end user by adding widgets to the page. If they add a large number of widgets, the page could end up with a large height. In one instance, we have a user that is generating a page with a height of nearly 2200px. However, the resize/autogrow is only growing the page to 2000px.

If I use Chrome's Inspect Element feature and change the height of the canvas iframe do a larger value, such as "2500", the iframe will render the full page. However, if I then use the Chrome Javascript console to call the canvas resize function, it again sets the height of the iframe to 2000px. I haven't been able to find any documentation for a canvas height limit.

Even if I execute the following code, I still get a max of 2000px:

<script type="text/javascript">
    getPageHeight = function() {
        return Math.max($(document).height()
                        , $(window).height()
                        , document.documentElement.clientHeight);
    };
    Sfdc.canvas.client.resize(sfsrjson.client, {
        height: getPageHeight() + "px"
    });
</script>

getPageHeight properly returns the height of the page at the 2200ish px, however, the resize is still only setting the height of the canvase frame to 2000px.

How do I get canvas to show my whole page?

4

I just ran into this problem.

The default maxHeight of a canvas app is 2000px. Apparenlty, you can't go beyond the maxHeight even when using the canvas sdk. You have to explicitly set your maxHeight to 'infinity' (or some other number if you don't want it to be able to grow indefinitely). This allows the canvas app to extend beyond the 2000px limit.

<apex:canvasApp applicationName="Foo_Integration" parameters="{!ppsp}" width="100%" maxHeight="infinite"/>

 

https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_canvasApp.htm

| improve this answer | |
  • The same also applies to the width, which has a default maxWidth of 1000. – Daniel Ballinger Jun 22 '16 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.