0

I have a VisualForce page inside a standard SFDC Page Layout. For UX reasons, we want to be able to refresh the outer (parent) page when something is clicked on the VF page. When we try and do this using parent.location.reload(), we get the CORS JS error:

Uncaught SecurityError: Blocked a frame with origin "https://my_domain.c.cs20.visual.force.com" from accessing a frame with origin "https://my_domain.cs20.my.salesforce.com". Protocols, domains, and ports must match.

So we went to CORS whitelist, and added https://*.visual.force.com as an entry. But this still did not fix the issue. Anyone else come across this?

  • Hi, Have you tried using top.location.reload(); instead of parent. – manjit5190 Feb 2 '16 at 19:35
  • Yes, same error – hamayoun Feb 2 '16 at 19:40
  • Depending on what your embedded VF page is doing, another option is to use the pattern shown here: salesforce.stackexchange.com/questions/37036/… – Mark Pond Feb 5 '16 at 1:28
  • Well, you got further than I have. I created a VF page that contains only <h2>Hello</h2> and all I see is an empty (blank) section on the page and a bunch of blocked origin messages in the console log. – tggagne Jun 9 '16 at 16:54
2

Looks like there's no workround for the CORS issue, so solution is to solve it by using HTML "form" and "action" to refresh parent page, as per this article.

https://www.xgeek.net/en/salesforce/refresh-standard-detail-page-from-visualforce-page-in-iframe/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.