以编程方式打开一个新窗口(或新选项卡),而不是始终弹出窗口

时间:2014-04-16 08:58:35

标签: angularjs popup window window.open

我试图用AngularJS创建一个新窗口

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

它始终打开一个弹出窗口,但从不打开普通窗口或新选项卡。为什么呢?

我将Angular 1.2.9与Chrome,Firefox和IE10一起使用。

我的问题只是chrome 34!

3 个答案:

答案 0 :(得分:2)

$window.openwindow.open实际上是一样的,与角度无关。在新窗口或标签中打开,取决于用户,以及他们使用浏览器初始化的设置。

对于target="_blank"的锚链接也是如此。

答案 1 :(得分:0)

试试这个

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

window.location.href = _url;

答案 2 :(得分:0)

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