我想在显示成功消息后关闭当前窗口,并使用scriptmanager重定向到登录页面。 [英] I want to close the current window after showing success message and redirect to login page using scriptmanager.

查看:108
本文介绍了我想在显示成功消息后关闭当前窗口,并使用scriptmanager重定向到登录页面。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





它不工作,

ScriptManager.RegisterStartupScript(Page,this.GetType(),Alert, alert('成功,您的新密码已发送到您的邮箱,使用新密码登录'); window.parent.location.href ='.. / Login.aspx'; self.close();,true) ;





如何让它工作,请建议。



我想在显示成功消息后关闭当前窗口并使用scriptmanager重定向到登录页面。

解决方案

浏览器并不总是关闭当前窗口。如果当前页面显示在浏览器的选项卡中(这不是唯一的选项卡),则通常会忽略对 window.close()的调用。我希望你理解背后的原因。


此外,如果有可能,它看起来像是滥用。例如:假设您创建了一个弹出窗口(在大多数情况下也不鼓励),因此没有多个选项卡,因此可以通过JavaScript关闭窗口。但它应该以一种非常明确的方式完成,比如说,只能按下按钮 C lost。但是留给用户会更好,他们当然可以看到非客户端窗口关闭控件并且知道何时关闭窗口更好。



-SA

Hi,

It is not Working,
ScriptManager.RegisterStartupScript(Page, this.GetType(), "Alert", "alert('Succeeded, your new password has been sent to Your Mail, Login with new Password'); window.parent.location.href='../Login.aspx'; self.close(); ", true);


how to make it work , please suggest.

I want to close the current window after showing success message and redirect to login page using scriptmanager.

解决方案

Browsers don't always close the current window. If the current page is shown in a browser's tab, which is not the only tab, the call to window.close() is usually ignored. I hope you understand the reason behind that.

Besides, if it was possible, it would look as abuse. Just for example: let's say, you created a popup window (also discouraged in most cases), so there are no multiple tabs, so the window can be closed by JavaScript. But it should be done in a very explicit manner, say, only on the clock on the button "Close". But it would be even better to leave to the user, who can certainly see the non-client window closing control and knows better when to close a window.

—SA


这篇关于我想在显示成功消息后关闭当前窗口,并使用scriptmanager重定向到登录页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆