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
Ritika JRitika J 

Open VF page in new window

Hi ,

 

I have to display a vf page in new window  on click of a command link  . right now it is opening in same window.

Please help me with this.

 

Thanks

ritika

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below code sample :

 

<apex:page showHeader="false">
<apex:form >
<script>
var newWin=null;

function openPopup()
{

var url="/apex/RelatedChildContact";  // Change this with your Vf page 
newWin=window.open(url, 'Popup','height=500,width=600,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');

newWin.focus();
return false;


}


function closePopup()
{

if (newWin.parent != null)
{
newWin.close();
}
}


</script>
<apex:commandLink value="Open" onclick="openPopup();"/><br/>
<apex:commandLink value="Close" onclick="closePopup();"/>

</apex:form>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

aballardaballard

How about <apex:commandlink target="_blank" ...  />

hemantgarghemantgarg

target="_blank" will also open the url on new window.