new window in visual force page

My problem is when click on link, the new window takes up the existing window.

My requirement is when click on link, the new window just pop up as tab, without taking up the exisitng window. So that user won’t feel distrubed.

<apex:outputLink value="#" onclick="return goToAnotherPage('{!studentId}');">

In JS,

window.location = '/apex/VF_AnotherPage?studentId=' + studentId;

How can I make a new window , without taking up the existing window. I need to pass Parameters too.

Answer

<apex:outputLink value="/apex/VF_AnotherPage?studentId={!studentId}" target="_blank">

The target=”_blank” will open a new window .

In javascript

window.open('/apex/VF_AnotherPage?studentId=' + studentId);

By default window.open has name parameter as _blank.

Attribution
Source : Link , Question Author : kitokid , Answer Author : Mohith Shrivastava

Leave a Comment