如何使用ie 11打开新浏览器窗口中的链接

时间:2017-06-06 09:19:57

标签: javascript internet-explorer-11

我可以点击新浏览器(弹出窗口)窗口打开链接吗?

我尝试过的事情:

<a href='http://osric.net/' onclick='return !window.open(this.href);'>osric.net web hosting</a>

功能onclick:

var windowObjectReference;
var strWindowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes, toolbar=yes";

function openRequestedPopup() {
  windowObjectReference = window.open("http://www.cnn.com/", "CNN_WindowName", strWindowFeatures);
}

但有了这些,它只会在新标签页中打开。

2 个答案:

答案 0 :(得分:0)

这适用于IE 11:

<script>
function popupBrowser(url) {
  window.open(url, "WindowName", "config=menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,fullscreen=yes");
}
</script>

<a href="javascript:popupBrowser('http://www.cnn.com')">Open a new browser for IE11</a>

它只是使用windows.open()

来模仿浏览器

JSFiddle demo

答案 1 :(得分:-1)

这就是

<a href="your_link" target="_blank">Visit</a>

target =“_ blank” - 是关键

将此用于新窗口

<a href="print.html"  onclick="window.open('print.html', 'newwindow', 'width=300, height=250'); return false;"> Print</a>

参考:Make a link open a new window (not tab)