diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js index ee1876d9f4f..1cfc7bb69ef 100644 --- a/addons/web/static/lib/qweb/qweb2.js +++ b/addons/web/static/lib/qweb/qweb2.js @@ -295,15 +295,13 @@ QWeb2.Engine = (function() { } req.open('GET', s, async); if (async) { - req.onreadystatechange = function() { - if (req.readyState == 4) { - if (req.status == 200) { - callback(null, self._parse_from_request(req)); - } else { - callback(new Error("Can't load template " + s + ", http status " + req.status)); - } + req.addEventListener("load", function() { + if (req.status == 200) { + callback(null, self._parse_from_request(req)); + } else { + callback(new Error("Can't load template " + s + ", http status " + req.status)); } - }; + }); } req.send(null); if (!async) {