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
John NeffJohn Neff 

Question regarding Hyperlink bahavior on Visualforce page - how to open in new window (not tab)?

Hello, 

I would like to create a hyperlink on one of my VF pages where upon click a new window opens that is 500px X 500px.  This will be for a "Help topic" - but I can not seem to figure out how to force the hyperlink to open in a new window and not a new tab.  

I tried using something like this: 
<b><apex:outputLink onclick="window.open(URL,'/apex/Probability_Guide','width=500,height=500')">Prob%</apex:outputLink></b>

And the new window is opening properly, but the page displayed in the new window is just a repeat of the page where the link resides.  How do I direct the new window to open /apex/Probability_Guide?

Thanks in advance!

John
 
Best Answer chosen by John Neff
Pramodh KumarPramodh Kumar
Here is snippet for your scenario. Let me know if you have any issues.
 
<b><apex:commandLink reRender="button"  onclick="window.open('/apex/Probability_Guide','','width=500,height=500')" id="button">Prob%</apex:commandLink></b>

Thanks,
pRAMODH.
 

All Answers

Pramodh KumarPramodh Kumar
Here is snippet for your scenario. Let me know if you have any issues.
 
<b><apex:commandLink reRender="button"  onclick="window.open('/apex/Probability_Guide','','width=500,height=500')" id="button">Prob%</apex:commandLink></b>

Thanks,
pRAMODH.
 
This was selected as the best answer
John NeffJohn Neff
Thank you very much, that is perfect!