Close Window code below was not working i have used the following code:

VF page:

 <script type="text/javascript">
   function CloseWindow()


<apex:commandButton id="Save" value="Save PTO Request" action="{!Save}" onComplete="CloseWindow();"  />

You can use ActionStatus tag for this

<apex:commandButton id="Save" value="Save PTO Request" action="{!QuickSave}" status="closer"/>
  <apex:actionStatus startText="(Saving...)" stopText="" onStop="CloseWindow();" id="closer"/>

Use the same script as you have used. And use this code. It will definitely work.

| improve this answer | |

As soon as you close the window JavaScript no longer executes. No code can run following the page closing. This is a browser security feature.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.