function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jen BennettJen Bennett 

Old Console and VisualForce Pages

I asked this question out on the salesforce stackexchange but wanted to post it here as well as suggested by SalesForce support:

I have a relatively simple visualforce page that just uses the apex:detail to show the cases detail on the page. With that comes the out of the box change owner and change record type links and related record links. None of the links work due to the following security error: "Uncaught SecurityError: Blocked a frame with origin "https://c.myinstance.visual.force.com" from accessing a frame with origin "https://myinstance.salesforce.com". Protocols, domains, and ports must match. I have scoured the internet for a solution to this problem and have tried the suggestions for using the salesforce console integration toolkit. However, even the very first example in the SCIT guide does not work. When in the console and using the links on the example page I get the following error: "Uncaught TypeError: Cannot read property 'Listener' of undefined iframeinterface.js:1 Sfdc.xdomain.IframeInterface.handleOnload iframeinterface.js:1 window.onload" When not in the console I get the security error like the initial issue with a basic visualforce page with standard links in the console. Any help on this would be greatly appreciated! On a side note, I have been able to get simple functions to work, like testIsInConsole.
KevinPKevinP
I can at least explain the errors your getting, but I don't know that i have a solution for you. 

When you incorporate a visualforce page inside an object's detail page, or the old console, you're really loading that page within an iframe. Unfortunately, the domains (or at least the subdomains) of pages loaded via iframes are not the same as standard apex pages like the console. Hence the mis-match warning. You *may* be able to get arround this by creating your own iframe, and manually forcing the src url to be http://myInstance.visual.force.com rather than .salesforce.com but I can't guarantee that saelsforce's redirection rules won't break that.
Jen BennettJen Bennett
Thanks Kevin, I really wanted to keep the pages simple as possible. Since it is such a basic page with just apex:detail that doesn't work I'm hoping it's something SalesForce will address, especially since the VisualForce guide walks you through creating a tabbed page using that tag. Someone else suggested disabling clickjack protection on non SalesForce setup pages, but I'd rather not do that just yet.