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
Salesforce seekarSalesforce seekar 

very urgent### window.close() not working in Experience site built in Aura

Hi All , 
I have an experience site built on Aura frame work . 
I have built an aura component for cancel button , when ever user clicks cancel , the tab having the site should close automatically . can anyone help its urgent

my cmp code: 
   <lightning:button variant="brand-outline" label="Cancel" title="Brand action" onclick="{! c.handleClick }" />


    handleClick : function (cmp, event, helper) {
        alert("You clicked: " + event.getSource().get("v.label"));

User-added image
Arun Kumar 1141Arun Kumar 1141

Hi Salesforce seekar,

You are checking this in builder that is why it is not working. It will work fine if you will check it after publishing and going to site(Not builder)

Please mark it as the best answer if it will help you.

SwethaSwetha (Salesforce Developers) 
@Salesforce seekar ,I've added the provided code to my experience site and can see that clicking the cancel button gives alert as "You clicked: Cancel" and closed the tab entirely. 

Let me know if you are seeing anything different. Thanks
Salesforce seekarSalesforce seekar
Hello  @swetha  @Arun Kumar 1141,
Thanks for responding...... 
its not working in my chrome browser... alert is comming but browser is not closing . you may please try to  paste below site on browser and click .