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 

apex:outputlink refreshing page on click. how do I stop this?

Hello, 

I am using apex:outputLink on a vf page to open a new window - but it is refreshing my original page upon click.  Is there a way to stop this?  Here is my link. 
 
<apex:outputLink onclick="window.open('AllSpotsMoreDetails?id={!spotObj.Id}', 'newwindow', 'width=800, height=900')"> More Details</apex:outputLink>

Thanks, 

John

 
Best Answer chosen by John Neff
Nayana KNayana K
Try
<apex:outputLink onclick="window.open('AllSpotsMoreDetails?id={!spotObj.Id}', 'newwindow', 'width=800, height=900');return false;"> More Details</apex:outputLink>

OR
<apex:commandLink onclick="window.open('AllSpotsMoreDetails?id={!spotObj.Id}', 'newwindow', 'width=800, height=900');return false;" value="More Details" rerender="dummy"/>

All Answers

Nayana KNayana K
Try
<apex:outputLink onclick="window.open('AllSpotsMoreDetails?id={!spotObj.Id}', 'newwindow', 'width=800, height=900');return false;"> More Details</apex:outputLink>

OR
<apex:commandLink onclick="window.open('AllSpotsMoreDetails?id={!spotObj.Id}', 'newwindow', 'width=800, height=900');return false;" value="More Details" rerender="dummy"/>
This was selected as the best answer
John NeffJohn Neff
Thanks Nayana, the first option worked perfectly!

I appreciate it. 

John
Nayana KNayana K
Glad to know that it worked :)