[SalesForce] How to determine if a VF page is invoked in a console

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?

Best Answer

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>
Related Topic