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
Abhishek SarafAbhishek Saraf 

Standard Visual Force Page is Not refreshing from pop child window after closing

I have created a  new button on standard page of a Custom Object, which is calling a pop-up window, for that I have wrote following code

JS code On Cllick on button for  Standatrd Object Page
alert('Hi');
 var newWin=null;
(function(){
})();
function closeSuggestedPopup()
{
window.location.reload();
}


//Following is the VF Pop-up VF Page

<apex:page standardController="Contact_Centre_Campaign__c" extensions="CC_CallListQueueLookup" showHeader="false" sidebar="false">
    
    <script>
       
    function setID(elem){
        var queueID = elem.options[elem.selectedIndex];
        var hiddenElem = document.getElementById('{!$Component.seletForm.hiddenId}');
        var queueName = document.getElementById('{!$Component.seletForm.QueueName}');
        hiddenElem.value = queueID.value;
        queueName.value = queueID.text;
        window.alert(hiddenElem.value+ queueName.value);
        
    }
    function CloseWindow(){
           alert('hi');
    }
    
    </script>
    
    
    <apex:form id="seletForm">
            <apex:actionFunction action="{!reAssignQueue}"  name="CallreAssignQueue"/>
            <apex:outputLabel value="{!$Label.Queues}"></apex:outputLabel>
             &nbsp; &nbsp;
             <apex:inputHidden value="{!Contact_Centre_Campaign__c.HiddenQueueID__c}" id="hiddenId"/>
             <apex:inputHidden value="{!Contact_Centre_Campaign__c.Queue__c}" id="QueueName"/>
            <apex:selectList multiselect="false" id="selectQueue" size="1" onchange="setID(this);">
                <apex:selectOptions value="{!items}"></apex:selectOptions>
            </apex:selectList>
            <apex:commandButton action="{!reAssignQueue}" value="Assign Queue" onComplete="javascript:CloseWindow()"/>
          
    </apex:form>
</apex:page>

I have tried same approch with VF page and that was working but for standard Object page it is not working and after oncomplete action I am getting following error
'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://c.cs9.visual.force.com' is therefore not allowed access.


 
Subhranshu MohantySubhranshu Mohanty
Hi Abhishek,

<script>
        function refreshParent() {
            window.close();
        }
  </script>

<apex:commandButton value="Save" onClick="refreshParent();"/>

Plz do disable your develoepment mode.
 
Abhishek SarafAbhishek Saraf
Thank You Subbu, but I have figure out the resaon, which is to avoid cross site request forgery SF doent allow you do the action I want, but I have used bootstrap modal inside stndarad page and in inside that modal, I am include VF Page to avoid confilict.