Mulder3
Mulder3

Reputation: 55

Open a new window (or new tab) programmatically instead of always a popup

I'm trying to create a new Window with AngularJS

var _url = 'http://extern.com/index.html'; 
$window.open(_url);

It always opens a pop-up window, but never a normal window or a new tab. Why?

I use Angular 1.2.9 with Chrome, Firefox and IE10.

My problem is only the chrome 34!

Upvotes: 2

Views: 3911

Answers (3)

freddy83
freddy83

Reputation: 63

var _url = 'http://extern.com/index.html'; 
var tabWindowId = window.open('about:blank', '_blank');
tabWindowId.location.href = _url;

Upvotes: 1

Prashobh
Prashobh

Reputation: 9542

Try this

var _url = 'http://extern.com/index.html'; 

window.location.href = _url;

Upvotes: 0

Matt Way
Matt Way

Reputation: 33161

$window.open is really just the same as window.open, which doesn't have much to do with angular. In terms of opening in a new window or tab, that is up to the user, and the settings they have initialised with their browser.

Also the same goes for anchor links with target="_blank".

Upvotes: 2

Related Questions