最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Silverlight - Close Browser Window - Stack Overflow

programmeradmin2浏览0评论

I have a Silverlight application that launches another Silverlight application in a new browser window. The new Silverlight application has a button called "Close". When a user clicks "Close", I run the following code:

HtmlPage.Window.Invoke("close");

This code works on IE just fine. However, it does not work in Chrome. How do I write code that will close the window in both IE and Chrome?

Thank you!

I have a Silverlight application that launches another Silverlight application in a new browser window. The new Silverlight application has a button called "Close". When a user clicks "Close", I run the following code:

HtmlPage.Window.Invoke("close");

This code works on IE just fine. However, it does not work in Chrome. How do I write code that will close the window in both IE and Chrome?

Thank you!

Share asked Sep 27, 2011 at 15:30 Phone DeveloperPhone Developer 1,4614 gold badges25 silver badges36 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

It's a known issue in Chrome browser. To workaround it, insert the following line before you call "close":

HtmlPage.Window.Invoke("open", new object[] {"", "_self", ""} );
HtmlPage.Window.Invoke("close"); 
发布评论

评论列表(0)

  1. 暂无评论