Silverlight - Close browser window

I have a Silverlight application that launches another Silverlight application in a new browser window. The new Silverlight application has a Close button. When the 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 to write code that closes the window in both IE and Chrome?

Thanks!

+4
source share
1 answer

This is a known issue in the Chrome browser. To work around this, insert the following line before calling close:

 HtmlPage.Window.Invoke("open", new object[] {"", "_self", ""} ); HtmlPage.Window.Invoke("close"); 
+7
source

All Articles