I have a pretty simple save action in my controller that redirects to record from pageReference but its returning an error Refused to display 'https://cs72.salesforce.com/0015D000009wrmEQAQ' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

here's the controller part...

public PageReference cancelAndRedirect(){

    return retPage(); 

public PageReference saveAndRedirect(){     insert callLog;

    return retPage();

public PageReference retPage(){
    PageReference retPage = new PageReference('/' + this.retUrl);   
    return retPage; 

<apex:pageBlockButtons location="top">
    <apex:commandButton value="Save" action="{!saveAndRedirect}" reRender="buyerDetailMain" />
    <apex:commandButton value="Cancel" action="{!cancelAndRedirect}" immediate="true"/> 

Salesforce for some reason is trying to open the page into an iframe from the same vfpage....

I'm not keen on using javascript to do the redirect as this is quite a direct functionality....or am I missing something?

  • I realize it really late...sorry for the post...if the showHeader or showSiderbar is set to true, your page is basically in an iframe...but if both are set to false, you're not in an iframe....so smart salesforce! Commented Feb 13, 2018 at 7:35

1 Answer 1


I've experienced this issue before and found that having the Salesforce Developer Mode on was causing the issue.

This can be turned off by navigating to Setup -> Users -> Your User -> Turn Developer Mode off.

  • This was the problem for me, thanks!
    – James
    Commented Sep 4, 2020 at 10:26

You must log in to answer this question.

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