Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open a link in a new window?

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?

like image 303
Chris Avatar asked May 13 '10 14:05

Chris


People also ask

How do I open a link in a new tab window?

You just need an anchor ( <a> ) element with three important attributes: The href attribute set to the URL of the page you want to link to. The target attribute set to _blank , which tells the browser to open the link in a new tab/window, depending on the browser's settings.

How do I open a website in a new window?

Using Right Click. Right click on the link on your current window. Choose Open in New Window . The page will open in a new window.


1 Answers

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.

like image 194
Sarfraz Avatar answered Oct 17 '22 01:10

Sarfraz