I have a VF page with a button. When the button is clicked, I would like a new tab to be open for the defined URL. At the same time, I would like the original VF page to remain at its original state. Currently, I am experiencing different behavior in classic and lightning. Lightning - A new Tab is open for the new page, but my original page gets reset. Classic - The current tab is overwritten with the new page.

Here is my code: VF Page:

<apex:commandButton styleclass="slds-button slds-button--neutral slds-grow" value="Report Duplicates" action="{!reportDuplicates}" />


public pageReference reportDuplicates(){

     pageReference reportDups = new PageReference('https://google.com'
     return reportDups;
  • I think I figured it out. Have to use: <apex:commandlink action="{!reportDuplicates}" target="_blank">
    – Ivo Dimov
    Feb 24 '20 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.