You need to sign in to do that
Don't have an account?
Karol Zaorski 8
<apex:detail> standard buttons don't work on VF page
Hi All,
I'm using visualforce page to show Quotes. Withing VF page I use <apex:detail> to show standard Quote layout. However Create PDF button don't work and browser debug console is showing this error
Uncaught SecurityError: Blocked a frame with origin "https://c.na23.visual.force.com" from accessing a frame with origin "https://na23.salesforce.com". Protocols, domains, and ports must match.
I'm using visualforce page to show Quotes. Withing VF page I use <apex:detail> to show standard Quote layout. However Create PDF button don't work and browser debug console is showing this error
Uncaught SecurityError: Blocked a frame with origin "https://c.na23.visual.force.com" from accessing a frame with origin "https://na23.salesforce.com". Protocols, domains, and ports must match.
The error which you are getting is because of SAME-ORIGIN policy. VF pages are serverd from different domain then the standard salesforce pages. And when you click on the button is VF which on domain "https://c.na23.visual.force.com", could be trying to access data from salesforce using javascript which on "https://na23.salesforce.com" domain, and it fails because they are not the SAME-ORIGIN. This restriction is applied at the browser end.
I also faced similar issue and unfortunately there is no workaround in case of salesforce when you use javascript, to resolve this issue, you can use controller to get the information required which you are getting from the button click instead of using javascript.
If you want to read more about SAME-ORIGIN policy, you can read it here.
https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options
Regards,
Vvek Patel
Please mark this as sovled if this answers your query to help others find the correct answer.
thanks for your response. I know that this is because of SAME-ORIGIN policy. But I wanted to highlight that button which doesn't work is generated from <apex:detail> component - no custom java script added. I was hoping that standard buttons will work fine when displayed via <apex:detail>. I was hoping that Salesforce will allow their own domains in cross reference callouts.
Regards,
Karol
Unfortunately that's the limitation from salesforce they do not allow access from VF domain to SF domain. They argue that it's for security reason which actually makes sense.
The same button I think works when you do not use the visualforce page. If you paste the code of the button, I can have a look what might be causing the issue.
Regards,
Vivek Patel.
It's a standard Create PDF button from Quote object, there is no custom javascript there.
Regards,
Karol