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
Anthony Magalit IIAnthony Magalit II 

Unexpected Behavior of a Visualforce Page in an iFrame in the Lightning Experience

We are working on getting our app ready to be Lightning ready certified, and I found an issue we need help with.
Here’s the scenario: Our app has many use cases where it’s necessary to put our Visualforce pages in an iframe. In one use case, we have a Visualforce page in an iframe that is within another Visualforce page. The inner VF page has several buttons and links that are bound to methods in the VF page’s controller. These controller methods return a PageReference. When the buttons or links are clicked, the controller methods execute successfully and they return the PageReference object. But when the inner VF page refreshes, it takes over the top location, meaning the outer VF page is no longer containing the inner VF page, and the inner VF page is the only page within the Lightning container. 

Is this behavior expected? I can reproduce this issue with 2 basic VF pages and a basic Apex controller that mimics the behavior of our app (code below). It happens when the inner VF page has the isdtp parameter in the URL and the PageReference returned has it’s redirect attribute set to true.

// Controller code
public class TestControllerInLightning {
public PageReference controllerAction() {
PageReference ref = new PageReference('/apex/InnerPageInLightning');
ref.setRedirect(true); 

return ref;

}

// Outer page code
<apex:page >
<div>Text in the outer page</div>
<apex:form >
</apex:form> 
<iframe id="thisFrame" scrolling="auto" height="480" width="100%" frameborder="0" src="/apex/InnerPageInLightning?isdtp=p1"></iframe>
</apex:page>

// Inner page code
<apex:page controller="TestControllerInLightning" showheader="true" sidebar="true" >
<hr/>
<div>Text in the inner page</div>
<apex:form >
<apex:commandButton value="Hit Controller Action" action="{!controllerAction}" immediate="false" />
</apex:form>
</apex:page>

I will post screenshots of the what the issue looks like shortly.

Note, I posted this to the Lightning and Components chatter group in the partner community but didn't get any responses. And I logged a case with support but they said they could not help with this issue and I should post to the dev forum.  This is blocking our Lightning Ready Certification process.
Anthony Magalit IIAnthony Magalit II
User-added image

User-added image
MikenameMikename
Were you able to find a workaround for this?