We have a child visualforce page that opens from parent VF page using standard controller. We enter some values that needs to be updated back to parent page and close the child VF page. We want to close the child VF page. The following script is at the Child VF page but doesn't work. I referred to Question but there isn't any help on it
function CloseAndRefresh(){
var newWin = null;
newWin=window.opener.location.href="/{!$CurrentPage.parameters.id}";
if (window.focus){
newWin.Focus();
}
if (NewWin != null){
newWin.close();
}
}
</script>
<apex:pageBlockButtons location="both">
<apex:commandButton value="Close" onclick="CloseAndRefresh();return false;"/>
<apex:commandButton value="Save" action="{!save}" status="closer"/>
</apex:pageBlockButtons>