Randomblue
Randomblue

Reputation: 116263

Open a URL in a proper tab/window in Chrome

I'm trying to use window.open to open a URL in a new tab or window. At the moment I can only get it to open in a "pseudo-window" which ressembles more a pop-up than a proper window.

How can I use JavaScript to open URLs in a proper window or tab in Chrome?

Note: I've tried finding the code for the function window.open using the Code Search, but cannot find it.

Upvotes: 0

Views: 210

Answers (3)

frangly
frangly

Reputation: 172

$(document).ready(function() {
   $('#NewTab').click(function() {
        $(this).target = "_blank";
        window.open($(this).prop('href'));
        return false;
   });
});​

It may help you

Upvotes: 0

ikassi
ikassi

Reputation: 98

Open a URL in a new tab (and not a new window) using JavaScript

taken from here

$('a').click(function() {
  $(this).attr('target', '_blank');
}); 

Upvotes: 0

Some Guy
Some Guy

Reputation: 16190

As far as I know, this is controlled by the browser and we don't have a way to change it.

You could use a hyperlink with the target set to "_blank" and try, but that wouldn't be window.open.

Upvotes: 3

Related Questions