Play Games

Search This Blog

Saturday, December 5, 2015

How to open in new tab after executing PageReference method Salesforce

Apex Code:
public class PageReferenceRedirect {
    public pageReference Redirect() {
        PageReference pageRef = new PageReference('http://www.google.com');
        pageRef.setRedirect(true);
        return pageRef;
    }        
}
Visualforce Page:
<apex:page controller="PageReferenceRedirect" >
    <apex:form >
        <apex:pageblock > Here underline is removed from Command Link Button.
            <apex:commandlink action="{!Redirect}" target="_blank" style="text-decoration: none;">
                <apex:commandButton value="Redirect"/>
            </apex:commandLink>
        </apex:pageblock>
    </apex:form>
</apex:page>
Output:



1 comment:

  1. I didn't know you could change the appearance of the link button. Thank you so much.

    ReplyDelete