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
mike1051mike1051 

JavaScript pop up window (cross-origin frame issue)


I have button on Opportunity on click oh which i am opening a VF page window .After opening the URl becomes

https://c.cs16.salesforce.com/apex/VFpage

On Click of save button i am closing the opoup window and refreshing parent window but when i close it it show a javascript popup error after closing the window.It says

A problem with the OnClick JavaScript for this button or link was encountered:

Blocked a frame with origin "https://cs16.salesforce.com" from accessing a cross-origin frame.




I know this error is coming because the URL are different but i dont know how to solve this issue.

Can someone tell me how to solve that issue.Its urgent for me.
Vinit_KumarVinit_Kumar
Can you share your code as how you are doing it ??
mike1051mike1051
Hey

I am using below code for closing the window and rereshing...

window.top.close(); 
 window.opener.location.href="/{!$CurrentPage.parameters.Id}";


For opening a pop window from custom button below is the code

window.showModalDialog('https://cs16.salesforce.com/apex/PDFViewer?id={!Opportunity.Id}','',
  'dialogHeight:600px;dialogWidth:950px;center:yes;');

but when i open my pdf viewer page URL becomes

https://c.cs16.visual.force.com/apex/PDFViewer?id=006f0000004fKcj

You have any suggestions.???



Vinit_KumarVinit_Kumar
How are you calling your JS function to refresh and close the window.

The syntax looks good and should work !!