[SalesForce] VF Page Custom Console Component blocked due to Same Origin Policy

I have a custom Visual Force page and use it as a custom console component in the Service Console. It was working but not it's being blocked due to the same origin policy:

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

I understand same origin policy but what is the point of having Visual Force Page as an option in Custom Console Components if accessing a VF Page is just going to throw this error? What is the workaround for this? The weird thing is this exact code was working fine not too long ago – did something change recently?

Best Answer

enter image description here

The service cloud App set up,now has a whitelist domains as shown above and we can add domain URL there I believe to whitelist .Navigate to Setup>Apps>Service cloud app

Check this article on this https://help.salesforce.com/HTViewHelpDoc?id=console2_whitelist_domains.htm&language=en_US

na12.visual.force.com is what you will need to enter I believe .