![](/img/trans.png)
[英]How to open only external links in a new browser window via JavaScript?
[英]How to open links in new browser window using ie 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);
}
但有了這些,它只會在新標簽中打開。
這適用於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()
來模仿瀏覽器
來了
<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>
參考: 使鏈接打開新窗口(不是標簽)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.