将页面设置为在新的无边框窗口中打开

时间:2017-03-23 01:38:59

标签: javascript html css

有没有办法强制页面一直在新窗口中打开,无论用于打开它的链接是什么?通过在标题中添加一些内容?我知道target-“new”和window.open()但我希望页面本身始终作为一个新窗口打开,没有工具栏或滚动条显示,即使用于打开它的链接是generic()而没有target =“新的“或类似的指定。我只关心Internet Explorer。

提前致谢。

1 个答案:

答案 0 :(得分:3)

我实际上找到了一个很好的例子here

这里是片段(您可能需要在文本编辑器中键入此内容并首先打开该html文件,因为我似乎没有单独使用StackOverflow)

我希望这就是你要找的东西。

<html>
<head>
<title>Opening Multiple Popup Windows</title>

<script language="javascript">
<!--//
function myPopup(url,windowname,w,h,x,y){
window.open(url,windowname,"resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=n o,width="+w+",height="+h+",left="+x+",top="+y+"");
console.log("Opening: " + windowname);
}
//-->
</script>
</head>
<body>
<!-- Inside the parenthesis the order goes URL, window name, width, height, position from left, position from top-->
<!-- Note that by giving each popup window a different name each page will open in a seperate popup window-->
<a href="javascript:myPopup('http://www.cnn.com', 'CNN','300','300','10','300')">Open popup 1</a>
<br>
<a href="javascript:myPopup('http://example.com', 'Example.com','300','300','100','300')">Open popup 2</a>
<br>
<a href="javascript:myPopup('http://www.nbc.com', 'NBC','300','300','200','500')">Open popup 3</a>
</body>
</html>