2

I have a VF page which needs to be displayed in the Service console as well as a regular tab. The header should not be displayed in the console. However removing the header (showHeader = false) results in the help text hover links not working. This is fine as it is by design.

However I need the header to show up if this page was accessed in a regular tab. So is there a way to determine in Visualforce if the page is being invoked in a console v/s invoked differently so that the showHeader can be set accordingly?

3 Answers 3

0

There is an isinConsole method as part of the integration toolkit, but you could also test for the srcUp function as well. Something like this might work (not tested):

<apex:page standardController="Case" showHeader="checkConsole();">
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript">
    function checkConsole() {
        if (typeof(srcUp) == 'function') {
              return false; //yes in console
           } else {
              return true;
        }
    }
</script>
</apex:page>
2
  • Can we call a method from showHeader attribute. I tried and failed.
    – Ratan Paul
    Jun 6, 2016 at 7:01
  • JS methods do not work with this property.
    – dzh
    Sep 23, 2016 at 2:23
6

A better solution is to use the API function: sforce.console.isInConsole() as described here: www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_isinconsole.htm

if (sforce.console.isInConsole()) {

// do console logic specific code

} else {

// do standard app logic specific code

}

srcUp is an internal function and should not be relied on, in my opinion.

0

I've noticed that using <a href=''> instead of <apex:outputlink value=''> will display pages with standard headers.

So if you are integrating legacy VF pages and want an easy way to remove standard header and sidebar - move from <a> tags to <apex:outputlink>.

You must log in to answer this question.

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