function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matt SchetselaarMatt Schetselaar 

sforce.console.isInConsole() is not working for me

I have a Visualforce page that I'm building that I've embedded in my Account page.  I'm trying to put a button on there that will open another Visualforce page that has a flow embedded in it.  I need it to be able to open a subtab if a user is in the console but just run normally if not in the console.  I haven't been able to get it to work so I've tried to use sforce.console.isInConsole() and that is returning false each time.  This is what I have right now.
 
<apex:page standardController="Account" >

    <A HREF="#" onClick="testIsInConsole();return false">
         Click here to check if the page is in the Service Cloud console</A> 

    <apex:includeScript value="/support/console/38.0/integration.js"/>
    <script type="text/javascript">
        function testIsInConsole() {
            if (sforce.console.isInConsole()) {
                  alert('Is in console');
               } else {
                  alert('Not in console');
            }
        }
    </script>

...more visualforce page

</apex:page>

Any help on why that isn't working would be great!  I think if I can get that to work I should be able to launch the flow in a new tab.

Thanks!
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for same
1) http://amitsalesforce.blogspot.com/search/label/Console

Your code look good to me. DO minior change like below
<apex:page standardController="Account" >
    <apex:includeScript value="/support/console/26.0/integration.js"/>

    <A HREF="#" onClick="testIsInConsole();return false"> Click here to check if the page is in the Service Cloud console</A> 

    <script type="text/javascript">
        function testIsInConsole() 
		{
            if (sforce.console.isInConsole()) {
                  alert('Is in console');
               } else {
                  alert('Not in console');
            }
        }
    </script>


</apex:page>
Let us know if this will help you