tags:

views:

128

answers:

2

I have a click handler for a specific link, inside that I want to do something similar to the following:

window.location = url

I need this to actually open the url in a new window though, how do I do this?

+2  A: 

You can like:

window.open('url', 'window name', 'window settings')

jQuery:

$('a#link_id').click(function(){
  window.open('url', 'window name', 'window settings');
  return false;
});

You could also set the target to _blank actually.

Sarfraz
but this jquery code will not navigate to the target automatically
Amr ElGarhy
A: 

you will need to use window.open(url);

references:
http://www.htmlcodetutorial.com/linking/linking_famsupp_120.html
http://www.w3schools.com/jsref/met_win_open.asp

Amr ElGarhy