function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SaraHasNoLimitsSaraHasNoLimits 

Can I dynamically adjust the height of the new Visualforce Area component?

I am trying to add a visualforce page to the sidebar and I would have previously done this with a page and an iFrame, but I read that with version 31.0, this is no longer the proper way to do this and that next year code that does this may stop working. So, I am using the Visualforce Area type for the component, but it requires that I enter a height. What if my content is dynamic? Can it not adjust dynamically, or do I just have to set it at a higher value and then use the scrollbars (which I hate, btw)?

Any better options for this new control type?

logontokartiklogontokartik
I dont think there is a way as far as I know to dynamically set the height.
bob_buzzardbob_buzzard
Unfortunately you can't adjust the height dynamically, due to the browser's same origin policy.  The Visualforce page comes from a different server to the home page, so it can't see the DOM of the parent page or communicate with it.  Only the Visualforce page knows how big it actually is, and it can't access the parent page to adjust its size. You also can't use techniques such as HTML5 cross domain messages, as you can't change the standard home page to accept messages from child pages from different servers.

You used to be able to do this in a totally unsupported fashion via an HTMLarea homepage component with some cheeky JavaScript inside to adjust the iframe size, as HTMLarea components are served from the same server as the home page.  However, Summer 14 stops you from authoring new components containing JavaScript and come Summer 15 any that you have already in place will stop working.

The same issue applies to embedded Visualforce pages in record views - you either end up with a bunch of whitespace or scrollbars, neither of which are a great user experience.