14

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.

2 Answers 2

19
<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.

2
  • 3
    Mohith, I would recommend that you avoid using w3schools (see w3fools), and instead quote directly from MSDN or MDN instead.
    – sfdcfox
    Commented Oct 7, 2013 at 14:07
  • Thanks for letting me know.The site is not recommended is what i understand from the w3fools . Commented Oct 7, 2013 at 14:36
8

You can simply use:

<a href="#" onclick="return window.open('/apex/VF_AnotherPage?studentId=' + studentId);" >SomeText</a>

OR in JS

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .