windows.showModalDialog和window.open

  遇到一个有趣的情况,不知道是我经验不足,还是就是如此。

  项目中遇到这样的情况,在一个ASPX页面里,点击一个按钮,以ShowModalDialog的模式弹出一个页面,在弹出页面里,还有链接,点击后希望通过window.open打开下一个窗口,并隐藏工具栏、地址栏等.

  奇怪的事情来了,通过ShowModalDialog的窗口,打开window.open的页面,即使写了location=no,status=no,弹出的窗口,仍然带着地址栏。

  A页面:  

View Code
<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页面的内容>页面:  

View Code
<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页面再打开不带地址栏的页面的情况。

  

转载于:https://www.cnblogs.com/liver.wang/archive/2011/11/23/ModalDialog.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值