Notification when popup is closed using Silverlight's HtmlPage.PopupWindow()

Posted by Dan Auclair on Stack Overflow See other posts from Stack Overflow or by Dan Auclair
Published on 2010-04-28T17:45:40Z Indexed on 2010/04/28 18:07 UTC
Read the original article Hit count: 708

I am popping up an HTML page from a Silverlight application using the HtmlPage.PopupWindow() method. I am trying to handle the event of when the popup window is closed from within Silverlight. This is how I am attempting to do this:

 var window = HtmlPage.PopupWindow(new Uri("http://mypopup..."), "popup", options);

 EventHandler<HtmlEventArgs> windowClosed = (sender, e) =>
 {
     // would like to refresh the page when popup is closed...
     HtmlPage.Document.Submit();
 };

 window.AttachEvent("onUnload", windowClosed);

However the event handler never seems to get called. Is this something that is possible or am I missing something?

The Silverlight app and the HTML popup page are on the same domain, however they are actually on different ports. I was thinking that maybe the pages being on different ports would be considered a cross-site restriction and cause the JavaScript to fail.

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about popup