0

I'm trying to IFrame a Record from my Project Object to it's Grandchild the Case Object. There is an Object called Related_Doctor that sits in-between.

When I use the below code I get a "salesforce.com refused to connect."

<apex:page showHeader="false" sidebar="false" readonly="true"  standardController="Case" tabStyle="Case">
<apex:iframe src="/{!Case.Related_Doctor__r.Project__c}?isdtp=vw" scrolling="true" id="theFrame" />
<script>document.getElementById('theFrame').height = window.innerHeight ;</script>

Error Image

  1. I've also confirmed that Clickjack settings are off (see below)
  2. When I use Chrome's inspect element and open the link referenced for the IFrame in a new tab the pages loads as expected.

Clickjack Disabled

1 Answer 1

1

Visualforce pages are served from visual.force domain and standard record pages are served from salesforce or lightning.force domain. The error you are seeing is not because of salesforce but because of browser security.

You can notice in chrome console:

Invalid 'X-Frame-Options' header encountered when loading 'https://myDomain.my.salesforce.com/apexpages/devmode/devConsoleViewStateMetadataReceiver.apexp?sfdcIFrameOrigin=https%3A%2F%2Fmy-own-org-dev-ed--c.ap6.visual.force.com': 'ALLOW-FROM https://myDomain.ap6.visual.force.com' is not a recognized directive. The header will be ignored.

As a work around, you can create a page and implement apex:detail:

DemoPage.vfp:

<apex:page sidebar="false" showHeader="false" standardController="Account" >
    <apex:detail />
</apex:page>

and use it:

<apex:page showHeader="false" sidebar="false" readonly="true"  standardController="Case" tabStyle="Case">
    <apex:iframe src="/apex/DemoPage?id={!Case.AccountId}&myattr=myval" scrolling="true" id="theFrame" />
    <script>
        document.getElementById('theFrame').height = window.innerHeight ;
    </script>
</apex:page>
1
  • The above worked perfectly! Commented Jul 29, 2019 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .