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
Kalai ArumugamKalai Arumugam 

Closing sub tabs under console not working in Chrome

Using Javascript, I'm trying to close a sub tab upon 'Cancel' operation is not working in Chrome(47.0.2526.73 m). It's works absolutely fine in Friefox(v 42.0).

I'm using 'Cancel' from the follwoing visual force page in chrome/Firefox:(works fine in both)
https://csxx.salesforce.com/apex/selectActionVFPageNew?caseid=xxxx9000000vaar

Trying the same from, Agent panel(console):
https://csxx.salesforce.com/console?tsid=xxuC0000000wBhj
In Firefox - works fine
In Chrome - doesn't do anything
But, I can see an error in JS console,
"Scripts may close only the windows that were opened by it."

Can someone help me to fix this.
Kalai ArumugamKalai Arumugam
Code, I used:

<apex:page standardController="Case" extensions="selectActionNew" tabStyle="Case"> 
    <apex:includeScript value="/support/console/35.0/integration.js"/>
    <script type="text/javascript">
    if (sforce.console.isInConsole()) {         
        function closeTab() {
            //sforce.console.getEnclosingPrimaryTabId(callCloseTab);
            sforce.console.getEnclosingTabId(callCloseTab);
        }
        
        var callCloseTab = function(result) {            
            sforce.console.closeTab(result.id);
        };  
 
     } else {
        function closeTab() {
            window.top.close();
         }
     }     
    </script>   
   <apex:form id="RequestForm">    
   <apex:pageBlock >
    <apex:pageBlockButtons >
        <apex:commandButton value="Cancel" onclick="closeTab(); return false"/>
    </apex:pageBlockButtons>     
   </apex:pageBlock> 
  </apex:form>
</apex>