3

Hope you are doing fine. Currently, I'm facing an issue.

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://companyName--c.visualforce.com') does not match the recipient window's origin ('https://companyName--c.ap3.visual.force.com').

I've developed an Aura, and it also loads a VF page. In order to generate the VF page link I used the following line of the code and split it:

var hostname = window.location.hostname;

However, the hostname value is varying between the production environment and the Sandboxes.

Sandbox environment: https://companyName--c.visualforce.com

Production environment: https://companyName--c.instanceName.visual.force.com

I developed the code based on the Sandboxes, now facing the error in loading the VF page inside production org. How to fix this issue in production? Thank you in advance.

2
  • 1
    We are facing the same issue after loading update into production. Did you resolve the issue?
    – InitK
    Commented Jun 11, 2021 at 14:23
  • @InitK, I've added the fix, you can check on the answer.
    – Mehedi
    Commented Jun 12, 2021 at 15:34

1 Answer 1

3

I've found the fix. This issue is because of the inconsistency of the 'My Domain' setting between your Sandbox and Production orgs.

To fix this, go to Setup> My Domain> Click 'Edit' on the 'My Domain details'. Now make sure your Sandbox and Production org's 'My Domain details' settings are the same. For example, if your code is working fine in the Sandbox, then update your Production org's setting following the Sandbox org. Please check the image below for reference:

My Domain Details Settings

By the way, the domain URL structure will be changed and enforced at Summer 22" release. So, at that time you might need to refactor your code accordingly. Reference: Enhanced Domains

2
  • Thank you! Very helpful, this resolved our issue as well.
    – InitK
    Commented Jun 29, 2021 at 16:30
  • There is no option like stabilize visualforce in my org Commented Jun 8 at 21:11

You must log in to answer this question.

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