美好的一天!如何在浏览器上关闭窗口(ASP.NET MVC)
编辑: 我有简单的静态网站和脚本:当我按Cntrl-Enter-打开弹出窗口。然后按 - 提交 - 我发送post请求到我的mvc应用程序。
我写简单的ASP MVC应用程序,它的结果与工作在打开弹出窗口发送消息:所有done.Press按钮将其关闭”
返回结果到这个窗口:
public ActionResult Index()
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;
Response.AddHeader("Cache-Control", "no-cache");
return View();
}
我如何尝试关闭客户端窗口:
<script type="text/javascript">
function OnCloseForm()
{
this.window.close();
}
但我不能这样做! 我知道,我应该使用window.open(),然后我可以做window.close()。 但如何关闭弹出窗口在我的情况?
谢谢!
P.S. Unfortunatelly- window.close()不起作用。
可能重复(HTTP [如何在浏览器窗口中关闭当前标签?]:/ /stackoverflow.com/questions/2076299/how-to-close-current-tab-in-a-browser-window) –