From 46655871049622d90e30c8607d81d200dbc9e54d Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Wed, 6 Apr 2016 13:12:59 +0900 Subject: [PATCH] Fixed attachEvent error in ie --- django_socketio/static/js/socket.io.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/django_socketio/static/js/socket.io.js b/django_socketio/static/js/socket.io.js index 2d0de64..ed776e3 100644 --- a/django_socketio/static/js/socket.io.js +++ b/django_socketio/static/js/socket.io.js @@ -512,7 +512,11 @@ if (typeof window != 'undefined'){ HTMLFile.prototype._get = function(){ var self = this; this._open(); - window.attachEvent('onunload', function(){ self._destroy(); }); + if ('attachEvent' in window){ + window.attachEvent('onunload', function(){ self._destroy(); }); + } else { + window.addEventListener('load', function(){ self._destroy(); }, false); + } }; HTMLFile.prototype._open = function(){