diff --git a/src/core.js b/src/core.js index f0b5634a..2e93f716 100644 --- a/src/core.js +++ b/src/core.js @@ -2403,6 +2403,15 @@ Strophe.Connection.prototype = { // or on a gradually expanding retry window for reconnects var sendFunc = function () { req.date = new Date(); + /* This is a chrome CORS fix, + * Chrome changes the request method from POST to + * OPTIONS thus not carriying the initial xml stanza. + * this keeps the http request pending for random time + * period before restarting it. + * Setting content type of the request to text/plain avoids + * this problem + * */ + req.xhr.setRequestHeader('Content-Type', 'text/plain'); req.xhr.send(req.data); };