You need to sign in to do that
Don't have an account?

Visualforce to Lightning Communication
I wrote the communication from Visual Force to Lightning Component as shown here:
https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html
It worked great in the sandbox environment with no problems.
But when I deployed to production I get the following error:
Uncaught DOMException: Blocked a frame with origin "https://domain Name.visual.force.com" from accessing a cross-origin frame.
at window_blur (chrome-extension://ddaloccgjfibfpkalenodgehlhkgoahe/jslib/nuanria.FrameConnector.js:338:18)
https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html
It worked great in the sandbox environment with no problems.
But when I deployed to production I get the following error:
Uncaught DOMException: Blocked a frame with origin "https://domain Name.visual.force.com" from accessing a cross-origin frame.
at window_blur (chrome-extension://ddaloccgjfibfpkalenodgehlhkgoahe/jslib/nuanria.FrameConnector.js:338:18)
Without LockerService it is exactly the same as you have already observed.
The sole reason is the fact that visualforce pages are served from a different domain than Lightning Experience (holding your Lightning Component).
This is done by Salesforce on purpose and it's considered as a security feature. You can't turn it off.
Good news: there is an officially documented practice to overcome this frontier by using window.postMessage(). With that you can implement bidirectional communication between Visualforce and Lightning Components.
It is described in depth here: https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html (http:// https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html)
There is no need of making REST calls for communication between VF and Lightning or going back to server as crmprgdev describes.
window.postMessage() is also not affected by LockerService. In fact you can find in the documentation of LockerService that this Standard Javascipt API is even officially supported by LockerService:
http://documentation.auraframework.org/lockerApiTest/index.app?aura.mode=DEV
That means all this works fine with v40.0 and chances are very good that it will work in future versions either.
Mark as resloved if it helps :) :)
Thanks,
Bhanu Prakash
visit ForceLearn.com (https://www.forcelearn.com)
Why? and how do I fix it.