5

Is there a way to change the showHeader attribute in tag using javascript ? I have a VF page that I want to show headers if accessed outside the console but in a console I want it without the headers and sidebar.

7

I think you have 2 options here. The first one is to use purely javascript.

//header
document.getElementById('AppBodyHeader').style.display = 'none';
//sidebar
document.getElementById('sidebarDiv').style.display = 'none';

Your second option is to do that directly into your controller itself.

public Boolean showHeader {get;set;}
public TestController(){
    if (blablabla) showHeader = true;
    else showHeader = false;
}
<apex:page controller="TestController" showHeader="{!showHeader}">
0

can you do something like below?

        if(sforce.console.isInConsole()) { 
            sforce.console.openPrimaryTab(null, '/apex/CustomVFPage?inConsole=yes, true, 'Custom VF Page'); 
        }else{ 
            window.top.location.href = 'https://'+window.location.hostname+'/apex/CustomVFPage?inConsole=no; 
        }

I think, you don't have to do any extra processing on the page..this will automatically take care of displaying header or not when in console.

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.