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 '16 at 14:23

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

|improve this answer|||||
  • 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. – Sander de Jong Sep 19 '16 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.

|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.