I totally understand this question have been discussed hundreds of times, however all discussions I have found are up to the 2016 release.

Is it possible to resize a Visualforce page inside a Page Layout dynamically, depending on whether some content will be available or not?


1 Answer 1


Visualforce is pretty much in maintenance mode, and has been since Spring 14, with the only real updates being published either security updates or Lightning compatibility. This includes the ability to have a way to resize a page dynamically within any container. It doesn't work in Classic view (this was broken when Visualforce moved to its own sub-domain, and subsequently reinforced when pages stopped automatically loading custom scripts in custom buttons), and it doesn't work in Lightning (again, by design for security purposes). There is an idea you should go vote on to be notified when/if such a feature is ever released. Its current status is "UNDER CONSIDERATION," which means that there's at least a slim possibility that this will see the light of day at some point.

Of all of the really nifty hacks that were created, including custom JS buttons, sidebar hacks, script injections, etc, the only viable option that remains is probably using a custom Visualforce page and using apex:detail (this should continue to work for the foreseeable future, as this is not a cross-domain request). The UI is fairly well locked down compared to prior iterations, so using a full Visualforce page would probably be the most reliable method.

  • @sfcdfox our sales representative tell us we can move to Lightning after Summer release. Still too many things are missing. What would you suggest?
    – Edmondo
    May 1, 2017 at 18:59
  • So I was planning to put this code as a section (in the middle ) of a page layout. What do you suggest instead?
    – Edmondo
    May 1, 2017 at 19:02
  • 1
    @Edmondo1984 I don't know what you're doing with it, but probably either a popup or Lightbox. Something custom that is initiated by a click of a button or link instead of trying to embed the page. If you've ever seen the Quote PDF preview thing, you'll know what I'm talking about. And, you can possibly go to Lightning "now" as long as it's not missing a feature you need. For example, we need the Call Center stuff working, which is supposedly in Summer 17, but we plan on moving by the fall after the sales season is over.
    – sfdcfox
    May 1, 2017 at 19:06
  • we are mainly missing reporting stuff :( . What's Lightbox?
    – Edmondo
    May 1, 2017 at 19:13
  • @Edmondo1984 Not literally Lightbox, apparently, just some sort of modal dialog, like you'd see in Lightning (lightningdesignsystem.com/components/modals).
    – sfdcfox
    May 1, 2017 at 19:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .