Prevent undefined error

This commit is contained in:
Amauri CHAMPEAUX 2015-02-27 16:28:48 +01:00
parent 56bad3f84d
commit da23d4dd39
1 changed files with 18 additions and 7 deletions

View File

@ -50,15 +50,26 @@ var tarteaucitron = {
}); });
} }
if (typeof XMLHttpRequest !== 'undefined') {
XMLHttpRequest.prototype.open = function () { XMLHttpRequest.prototype.open = function () {
this.addEventListener('load', function () {
if (window.addEventListener) {
this.addEventListener("load", function () {
if (typeof tarteaucitronProLoadServices === 'function') {
tarteaucitronProLoadServices();
}
}, false);
} else {
this.attachEvent("onload", function () {
if (typeof tarteaucitronProLoadServices === 'function') { if (typeof tarteaucitronProLoadServices === 'function') {
tarteaucitronProLoadServices(); tarteaucitronProLoadServices();
} }
}); });
}
origOpen.apply(this, arguments); origOpen.apply(this, arguments);
}; };
} }
}
}, },
"load": function (params) { "load": function (params) {
"use strict"; "use strict";