I had/have a Visualforce page that displays an iframe that points to another page within my organization. It points to the page that renders an email template (like https://prodorg--c.na17.content.force.com/email/templaterenderer?id=00Xo0000000qhjUEAQ&recipient_type_id=003o000000rkJIKAA2&related_to_id=a00o000000uGVSE).

I had to do a little tweak on the page, but didn't change the iframe section. Once I deployed the change set in production (NA17) the iframe stopped working, but it still works on sandbox (CS22 instance).

I don't get it. I've done some research and I read about clickjacking, and how Salesforce started to enable some headers by default that would prevent loading external pages or something like that. But hey, my page works on sandbox and not on production? And all updates are applied to both, so I don't see why the page won't load on production.

Now I get the error message (on Chrome's console):

Refused to display 'https://login.salesforce.com/?ec=302&startURL=%2Fcontent%2Fsession%3Furl%3D…%2526preview_frame%253DcontentFrame%2526render_type%253DREPLACED_HTML_BODY' in a frame because it set 'X-Frame-Options' to 'DENY'.


After searching for a while, I ended with the conclusion that the URL I was using was no longer in use by Salesforce. It used mydomain.visual.force.com, and it now uses mydomain.content.force.com.

My solution was to create a custom setting that would hold this base URL so it could be used on other pages. In the end, my iframe code ended up like:

<iframe src="https://{!$Setup.MyGlobalVar__c.MyVFContentBaseURL__c}/email/templaterenderer?id={!template.Id}&recipient_type_id={!email.WhoId}&related_to_id={!Id}&base_href=https://{!$Setup.MyGlobalVar__c.MyVFContentBaseURL__c}/.salesforce.com&preview_frame=contentFrame&render_type=REPLACED_HTML_BODY" width="100%" height="600px" />
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.