遇到一个有趣的情况,不知道是我经验不足,还是就是如此。
项目中遇到这样的情况,在一个ASPX页面里,点击一个按钮,以ShowModalDialog的模式弹出一个页面,在弹出页面里,还有链接,点击后希望通过window.open打开下一个窗口,并隐藏工具栏、地址栏等.
奇怪的事情来了,通过ShowModalDialog的窗口,打开window.open的页面,即使写了location=no,status=no,弹出的窗口,仍然带着地址栏。
A页面:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<base target="_self"/>
<script language="javascript" type="text/javascript">
function ShowDialog() {
window.showModalDialog('WebForm6.aspx', "", '');
// window.open('WebForm6.aspx', '', 'status=no,location=no');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h5>window.showModalDialog('WebForm6.aspx', new Object(), '');</h5>
<asp:Button ID="Button1" runat="server" Text="ShowDialog" OnClientClick="ShowDialog()"/>
</form>
</body>
</html>
通过[window.showModalDialog('WebForm6.aspx', "", '');]打开一个ModalDialog窗口。
B<ModalDialog页面的内容>页面:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<base target="_parent"/>
<script language="javascript" type="text/javascript">
function ShowOpenNewWindow() {
window.open('http://www.baidu.com','', 'status=no,location=no');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<h5>
window.open(url,'', 'status=no,location=no');
</h5>
<asp:Button ID="btnOpen" runat="server" Text="Open" onclick="btnOpen_Click"/>
</div>
</form>
</body>
</html>
通过[window.open('http://www.baidu.com','', 'status=no,location=no');]打开一个百度的页面。
虽然明确写了location=no,但是还是看到地址栏了....
直接打开B页面,点击Open弹出页面,可以隐藏地址栏:
在A页面使用window.open打开B页面,再通过window.open打开页面,也显示正常。
不知道有没有高手对这个了解,有没有办法解决在ModalDialog页面再打开不带地址栏的页面的情况。