Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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}">
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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