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.

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

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

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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.