Skip to main content
Participating Frequently
April 19, 2011
Question

No disconnect on refresh (IE9).

  • April 19, 2011
  • 1 reply
  • 660 views

Hi,

When a user refreshes the page in IE9, the disconnect handler isn't called. So in an application like a fms lobby, a user seems to stay in the list when he actually isn't there anymore. Does anyone know a solution?

Thanks,

Thomas

    This topic has been closed for replies.

    1 reply

    Petro_O__Bochan
    Inspiring
    April 19, 2011

    Hello, this behaviour is inherent to virtual machines: sometimes it takes up to 3 minutes for the connect/disconnect update to take place. e.g. influxis does that :(. Other than that, your might be doing something different as expected.

    Participating Frequently
    April 20, 2011

    I found a solution for people who leave or refresh the page. With javascript and externalinterface you can call Flash before the unload and so you can close the connection:

    window.onbeforeunload = confirmExit;

             

    function confirmExit()

    {

         sendToFlash("leavepage");

    }

    function sendToFlash(str) {       getFlashMovie("yourflashmoviename in the embed tag").sendToFlash(str);     }

    function getFlashMovie(movieName) {        if (navigator.appName.indexOf("Microsoft") != -1)

         {

             return window[movieName];      }      else      {          return document[movieName];      } }

    In Flash:

    function getFromJavaScript(str)

    {

         if(str == "leavepage")

         {

              nc.close();

         }

    }

    ExternalInterface.addCallback("sendToFlash", getFromJavaScript);

    - Thomas