Question

I'm currently firing an event on onBeforeUnload to handle unwanted exits of the application. It works fine in IE and Firefox and I can logoff WCF duplex clients from my service instance. But it does not work in Chrome.

Is there any workaround for this ? My Chrome callbacks are always throwing timeout exceptions because of this.

Was it helpful?

Solution

Chrome terminates the Silverlight plugin very roughly. Code in the Application.Exit event may not work as expected. But you can ask the user, if he or she really wants to leave the page. Note that the event handler below does not return null.

<script type="text/javascript">
    // should work in chrome.
    window.onbeforeunload = function () { return ""; };
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top