The problem statement is From Inline Visualforce We need to open a Child window and then from that child window we need to refresh the Parent window of the Child window or redirect Parent window of the child window .
Last night ,I was struggling on how to redirect the Parent Window from the child window that was opened from the Inline window
I tried hard on how to solve this ,but finally last resort was to post the query on salesforce stackexchange .The below is the link for the same
The error was due to Javascript security of web browser .
I tried the below script on the child window
<script>
function test(){
alert('hello');
window.opener.top.location.href='https://googleflowauth-dev- ed.my.salesforce.com/001900000096agv';
}
</script>
Unsafe JavaScript attempt to initiate navigation for frame with URL 'https://googleflowauth-dev-ed.my.salesforce.com/001900000096agv' from frame with URL 'https://googleflowauth-dev-ed--c.ap1.visual.force.com/apex/pagereal'. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.
The browser security features don't allow navigation from child window directly since visualforce and standard detail page are in different domain.The above error is due to the same feature .
Stackexchange has really expert professionals and Eric suggested me the below solution.I am posting the same so that helps others
The Inline page on the parent window has the below code
<apex:page standardController="Account" extensions="Accountctrl">
<apex:form >
<script>
function openwindow(){
window.open("/apex/pagereal", "myWindow", "width=200, height=100");
}
function navigate(){
window.top.location.href='https://googleflowauth-dev-ed.my.salesforce.com/001900000096agv';//Parent function that redirects
}
</script>
<apex:pageBlock >
<apex:pageBlockSection columns="1" id="Test" >
<apex:inputcheckbox value="{!test.istest__c}" label="Same as Above">
<apex:actionSupport event="onchange" rerender="Test" />
</apex:inputcheckbox>
<apex:outputPanel rendered="{!NOT(test.istest__c)}">
<apex:inputField value="{!test.Campaign__c}" />
<apex:inputField value="{!test.cust_vendor__c}" />
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
Note that navigate function we will call from the child window and that would navigate parent frame
<apex:page >
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
<script>
function test(){
alert('hello');
window.opener.navigate();//call the parent function from child window and that does the trick
}
</script>
<apex:form >
<!-- End Default Content REMOVE THIS -->
<apex:commandButton onclick="test()" value="Test"/>
</apex:form>
</apex:page>
The child window script will call the opener window script and that in turn will redirect the parent frame .
Hope this trick will be useful .