By default I want my inline visual force section to be collapsed.I can only see show scrollbar,Height,Width and Show label under pagelayout settings.I know salesforce remembers the collapsed state.But In my case I always want my inline visual force section to be collapsed.How to achieve this.


I have created a hidden visualforce page(Zero height/Width) with Javascript code for collapsing my inline visualforce section on pageload and added it to page layout, but its not working.Can some one help me where I am going wrong.

<apex:page standardController="Account">
<script language="javascript">
 function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {

function dotest() {

 if(document.getElementById('{!$Component.head_01B3000000CARvA_ep}') != null){
  • are you willing to do a VF page that consists solely of an apex:detail tag and override the View button to point at the VF page? If so, then jQuery/javascript can be used on that page to do the auto-collapsing
    – cropredy
    Apr 15, 2014 at 17:35
  • No.I don't want to override the view button with vf page.
    – sfdc
    Apr 15, 2014 at 17:36
  • @crop1645 can we do a hidden visualforce page(zero height/width) on standard page layout with javascript in it.
    – sfdc
    Apr 15, 2014 at 18:09
  • pass - out of my area of expertise
    – cropredy
    Apr 15, 2014 at 19:35
  • $Component will refer to the 'hidden VF page' id hierarchy which will not be the standard page layout id hierarchy
    – cropredy
    Apr 15, 2014 at 19:52

1 Answer 1


This knowledge article gives an Idea on how to collapse the Pageblocksection by default.If you have the inline components in a separate pageblock section you can do the following to collapse it by default.


  • I want it on inline visualforce page on standard pagelayout not on a visualforce page with pageblocksections in it.
    – sfdc
    Apr 15, 2014 at 16:57
  • Duh my bad, the only way to modify standard page behavior is a sidebar hack. Earlier we could embed javascript in the section header,salesforce does not allow it anymore. Will be interesting to know if there is any one else who has a better trick to achieve this.
    – Rao
    Apr 15, 2014 at 16:59
  • Can you show me how to achieve this using side bar component.
    – sfdc
    Apr 15, 2014 at 18:04

You must log in to answer this question.

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