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
learnSFlearnSF 

open visual force page in new window from another visual force page command button.

Hi,

 

I have vf page with "PDF" command button on it.

 

When user hit this PDF button in controller renderPDF method call which redirect to another vf page.

 

I need this page should be open in new window instead of redirect to same window.

 

How I can do it with page reference?

 

Thanks, 

bob_buzzardbob_buzzard

I don't think you'll be able to do this via page references - there's nothing that the server can return to force the browser to open a new window.

 

You'd need to open the new window from the browser (via JavaScript or a link with a target attribute) and then carry out the renderPDF in that window.  You could do this using the action attribute from the page.

Jeff777Jeff777

Hi, LearnSF,

 

What I am trying to do is to open an external url(pdf) in the same window as current vf page resides, but it ends up opening at a new window by using PageReference. Wondering whether your "pdf" is created inside salesforce using vf page or from an external service call then rendered at vf page?

 

thanks,