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


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.



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


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


but when i open my pdf viewer page URL becomes


You have any suggestions.???

1 Answer 1


Have you considered just making the button a URL rather than OnClick JavaScript:


Alternatively, you could just make the button a Visualforce page but that does not accept parameters and the page must be tied to a controller extension.

  • I need to write Javascript to as I am doing other things too . second option I didn't understand. Can you explain in detail..thanks mate
    – miku
    Commented Jun 17, 2014 at 20:41
  • Are you redirecting in the parent frame? window.top.location.href = "/apex/MyPage";
    – greenstork
    Commented Jun 17, 2014 at 20:52
  • Hey i have updated my code..Can you please see what i am doing and suggest me something..
    – miku
    Commented Jun 18, 2014 at 6:29
  • This appears to be related to your problem: developer.salesforce.com/forums?id=906F00000008yuaIAA
    – greenstork
    Commented Jun 18, 2014 at 13:20
  • This is still not solved...Can you please help me..??
    – miku
    Commented Jun 19, 2014 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .