简体   繁体   中英

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:

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?

You will need to close the window through JavaScript. C# has no control over the browser. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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