asp.net 关闭当前页问题

skydhx 2014-09-09 02:04:23
如题, 要实现一个效果。 login登录的时候 成功关闭当前页 ,跳转到新页面, 新页面 类似f11最大化效果,
目前实现的效果是关闭当前页时有close window 提示,

怎么做到不询问是否关闭 的 提示呢, f11页面效果已经写好,求同行们看看 代码如下

protected void Button1_Click(object sender, EventArgs e)
{
string strScript = "<script> window.open('MainPage.aspx', 'fullscreen', 'fullscreen = yes, resizable = yes, height = 1200, "+
" width = 1600, top = no, left = no, location = no, toolbar = no, menubar = no');</script>";

Response.Write("<script>window.opener=null;window.close();</script>");// 不会弹出询问

}

...全文
264 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
1988525 2014-09-09
  • 打赏
  • 举报
回复
引用 11 楼 Sky_Dhx 的回复:
但是好像就 ie浏览器可以, 其他浏览器不行,依然没有关闭的效果 比如 火狐,
火狐得设置浏览器参数,火狐默认不让使用window.close
skydhx 2014-09-09
  • 打赏
  • 举报
回复
但是好像就 ie浏览器可以, 其他浏览器不行,依然没有关闭的效果 比如 火狐,
skydhx 2014-09-09
  • 打赏
  • 举报
回复
3q 解决了,
1988525 2014-09-09
  • 打赏
  • 举报
回复
引用 8 楼 Sky_Dhx 的回复:
[quote=引用 7 楼 u013756007 的回复:] [quote=引用 6 楼 Sky_Dhx 的回复:] [quote=引用 5 楼 u013756007 的回复:] window.opener=null; window.open('','_self'); window.close();
能写好点吗, button 事件里面怎么写的? [/quote] <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script> function aa() { window.opener = null; window.open('', '_self'); window.close(); } </script> </head> <body> <form id="form1" runat="server"> <div> <input id="Button1" type="button" value="button" onclick="aa()"/> </div> </form> </body> </html>[/quote] 还是不行, open 里面加了参数照样要弹出 提示框,[/quote] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script> function aa() { window.open('MainPage.aspx', 'fullscreen', 'fullscreen = yes, resizable = yes, height = 1200, width = 1600, top = no, left = no, location = no, toolbar = no, menubar = no'); window.opener = null; window.open('', '_self'); window.close(); } </script> </head> <body> <form id="form1" runat="server"> <div> <input id="Button1" type="button" value="button" onclick="aa()"/> </div> </form> </body> </html>
skydhx 2014-09-09
  • 打赏
  • 举报
回复
引用 7 楼 u013756007 的回复:
[quote=引用 6 楼 Sky_Dhx 的回复:] [quote=引用 5 楼 u013756007 的回复:] window.opener=null; window.open('','_self'); window.close();
能写好点吗, button 事件里面怎么写的? [/quote] <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script> function aa() { window.opener = null; window.open('', '_self'); window.close(); } </script> </head> <body> <form id="form1" runat="server"> <div> <input id="Button1" type="button" value="button" onclick="aa()"/> </div> </form> </body> </html>[/quote] 还是不行, open 里面加了参数照样要弹出 提示框,
1988525 2014-09-09
  • 打赏
  • 举报
回复
引用 6 楼 Sky_Dhx 的回复:
[quote=引用 5 楼 u013756007 的回复:] window.opener=null; window.open('','_self'); window.close();
能写好点吗, button 事件里面怎么写的? [/quote] <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script> function aa() { window.opener = null; window.open('', '_self'); window.close(); } </script> </head> <body> <form id="form1" runat="server"> <div> <input id="Button1" type="button" value="button" onclick="aa()"/> </div> </form> </body> </html>
skydhx 2014-09-09
  • 打赏
  • 举报
回复
引用 5 楼 u013756007 的回复:
window.opener=null; window.open('','_self'); window.close();
能写好点吗, button 事件里面怎么写的?
1988525 2014-09-09
  • 打赏
  • 举报
回复
window.opener=null; window.open('','_self'); window.close();
skydhx 2014-09-09
  • 打赏
  • 举报
回复
引用 2 楼 aschenge888 的回复:
直接跳转啊。。。。
不可以跳转的,就是打开一个 主页面,关闭当前的login页面, 不要提示那种
skydhx 2014-09-09
  • 打赏
  • 举报
回复
不行啊,要关闭当前的login 页面,而且不能有提示,纠结, 不是跳转,跳转就不能打开 类似 f11效果的页面,
真我风采 2014-09-09
  • 打赏
  • 举报
回复
直接跳转啊。。。。
於黾 2014-09-09
  • 打赏
  • 举报
回复
既然你要跳转,直接跳转就好了,干啥非要打开一个新页面,再关掉旧页面?

62,025

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧