Skip to content

When reloading a page, the onreadystatechange event fires #89

@wbecker

Description

@wbecker

This seems to cause the last message to resend.

I've noticed it with chattrr (github.com/wbecker/chattrr - hosted at chattrr.net). If you bring it up then refresh you will notice that the last message that you sent reappears.

I've trapped this by putting a window.onbeforeunload function in that sets a return value, putting a break point in and following it through, eg:

window.onbeforeunload = function (e) {
  e.returnValue="stop";
  return "stop";
}

It seems to go to the onreadystate handler:

XHRMultipart.prototype._get = function(){
   var self = this;
   this._xhr = this._request('', 'GET', true);
   this._xhr.onreadystatechange = function(){
   if (self._xhr.readyState == 4) self._onData(self._xhr.responseText);
   };
   this._xhr.send(null);
 };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions