Search code examples
javascriptjquerysalesforcevisualforce

Close Parent Tab after closing of child tab


 ====================Apex Class Code========================
Public Boolean isClosed{get;set;}
isClosed = false;
List<Opportunity> Affre_main = new List<Opportunity>();
for(Opportunity opp: [select id,Afree_main_sol__c from Opportunity where Id in: oppVar] ){
        opp.Afree_main_sol__c = 'some value';
        Affre_main.add(opp)
}
if(!Affre_main.isEmpty()){
    insert Affre_main;
    isClosed = true;
}

========================ON VF Page=================================================
<script>
if("{!isClosed}"){
    window.close();
    //Now how to close its parent tab//
}

</script>

I am looking for a workaround. I want to close a tab (say child tab) and then I want to auto-close the parent (main tab).

Is there any standard way then please tell me.

I want to use this solution with visualforce-salesforce.

Javascript/jquery solutions will also be helpful.


Solution

  • I find it myself.

    just a quick line solution.

    Just need to use window.opener.close(); to auto close the parent window from the open child window.