I have a Visualforce page with its own controller. One of the buttons on the page must go to a standard Opportunity page. I thought I would use this:

return new PageReference('/' + oppId).setRedirect(true);

but that only works partially: the Opportunity page is displayed with its own header and sidebar, so I see a header and a sidebar inside a header and a sidebar. Doing setRedirect(false) doesn't make any difference.

How do I refresh the complete page, how do I navigate away from the current page?

  • Are you running the Visualforce page inline to standard page or running it directly?
    – Raul
    Sep 15, 2016 at 14:23

2 Answers 2


When you are returning your page reference add the URL parameter


Although not officially support it hides the sidebar and header in classic. Also depending on the parameter you use, you loose some styling and functionality:


Or you can create a vf page

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

And redirect to it

  • Hmm... when I try this, I still get a nested view, as well as the error message 'URL no longer exists'. I guess I'm doing something wrong somewhere. You'd think it would be so easy to navigate to another page. Sep 19, 2016 at 7:27

What I had was a button that redirected to a VF page. The button has as property: "keep existing header and sidebar", the VF page had as property: "showHeader="false" sidebar="false""

But it must be the other way around: the button must open the VF page in a new/empty page and the VF page must have a header and sidebar.

The first way constrains all subsequent redirects, you can never 'escape' this constraint and return to the full page.

You must log in to answer this question.

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