+ Start a Discussion
justynjustyn 

Make a clickable link open in a new tab

Hi

 

I have a working search page on my system. It works great, but we often want to click on a number of entries to view data, and not have to click back and then click on another item. We can of course right click and open in a new tab, but not all my users are that technical. I want to edit the following code so that when you click on the field on the page it will open in a new tab.

 

<apex:column >               

<apex:facet name="header">                   

<apex:commandLink value="Name" action="{!toggleSort}" rerender="results,debug">                       

<apex:param name="sortField" value="name" assignTo="{!sortField}"/>                   

</apex:commandLink>               

</apex:facet>               

<apex:outputlink value="/{!counselling_practice.id}">                   

<apex:outputField value="{!counselling_practice.name}"/>               

</apex:outputlink>           

</apex:column>

 

Any thoughts?

 

Thanks

 

Justyn

Best Answer chosen by Admin (Salesforce Developers) 
vishal@forcevishal@force

Hi, 

 

in your commandLink and OutputLink tags, all you need to do is  - add the TARGET attribute and set it to target = "_blank" , this will open the links in a new tab. :)

 

 

All Answers

vishal@forcevishal@force

Hi, 

 

in your commandLink and OutputLink tags, all you need to do is  - add the TARGET attribute and set it to target = "_blank" , this will open the links in a new tab. :)

 

 

This was selected as the best answer
justynjustyn

That is great. Is it also possible to make it so that the new tab isn't automatically selected.

 

Justyn

@Suresh.ax1214@Suresh.ax1214

Hai ,

i am having the same issue. if your issue is solved then send me the solution please..............

 

Thnx in advance