2

I opened a vf page through the custom button on the object record. When user close this page I reload the parent window through javascript in the custom buttom, at this time I am getting a alert box saying this error.

Can anyone help me on this.

Thanks in advance.

4
  • 1
    Already has an answer salesforce.stackexchange.com/questions/17639/…
    – Ashwani
    Commented Oct 8, 2013 at 8:28
  • Thanks reddev but I am not using Iframe but in the url of child window (that I open on the click of button) contains the package namespace. it can be the issue??
    – Mahi
    Commented Oct 8, 2013 at 8:41
  • Yes it can be issue: na1.force.com != namespace.na1.force.com both are different. Browser won't allow it.
    – Ashwani
    Commented Oct 8, 2013 at 9:03
  • so do you have any solution for this??
    – Mahi
    Commented Oct 8, 2013 at 9:12

1 Answer 1

2

I assume that yo are using somethig like opener.location.reload(). Instead of this try to redirect the opener page to the same address:

Popup page:

<script>
    window.onunload=function(){
        opener.location.href = '/{!$CurrentPage.parameters.openerId}';
    };
</script>

Of course you need to notice the opener page ID in the popup URL. For that just insert that ID to the Custom Button code that opens a popup, somethid like this:

Custom button code:

newPopup = window.open("/apex/PopupPage?openerId={!Object__c.Id}", "myPopup", 
                       "width=300,height=200");
newPopup.focus();
4
  • Thanks @mast0r actually I have created a package in my org and as per my understanding this issue is beacuse when i open the vf page on click of button, it contains the namespace in the url but not in the record url and because domain is different this is showing error.. Please guide me on this..
    – Mahi
    Commented Oct 8, 2013 at 9:11
  • Well, i've tried my example with opener URL na9.salesforce.com and a popup URL c.na9.visual.force.com. And it works fine. Just try it. Commented Oct 8, 2013 at 9:13
  • I am doing like this var url="/apex/pagename?id="+"{!Account.Id}"; var val = window.showModalDialog(url,false,'dialogHeight:480px;');
    – Mahi
    Commented Oct 8, 2013 at 9:18
  • 1
    @Mahi Try to use window.open method. Commented Oct 8, 2013 at 9:42

You must log in to answer this question.

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