简体   繁体   English

如何使用C#关闭网页?

[英]How to close web page using c#?

I create popoup window: 我创建弹出窗口:

window.open(msg,'LoginPopup');

After popup window implemnet a Get request to this function in the server: 在弹出窗口implemnet之后,服务器中对此功能的“ 获取”请求

public void GmailOAuthCallback(string code)
{
    object contacts = GmailServiceWorkflow.GetContacts(code);
} 

I want to close the window. 我要关闭窗户。

Any idea how can I close the popup window whithin GmailOAuthCallback function? 知道如何在GmailOAuthCallback函数中关闭弹出窗口吗?

You will need to close the window through JavaScript. 您将需要通过JavaScript关闭窗口。 C# has no control over the browser. C#无法控制浏览器。 But, as a security feature, it's difficult to close a window from code. 但是,作为安全功能,很难从代码中关闭窗口。 Read more here: window.close and self.close do not close the window in Chrome 在此处了解更多信息: window.close和self.close不会在Chrome中关闭窗口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM