Thursday, August 20, 2015

Uncaught TypeError: Cannot read property 'msie' of undefined

I got this error in Google Chrome's console when I tried to use jquery.alerts and this offers the following hack to fix it:

jQuery.browser = {};
(function () {
   jQuery.browser.msie = false;
   jQuery.browser.version = 0;
   if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
      jQuery.browser.msie = true;
      jQuery.browser.version = RegExp.$1;
   }
})();

 
 

You'd put this upstream of the act causing the error, you know? The second of the two links I provide in this blog posting suggests that $.browser has been yanked out of modern jQuery and such is the source of this pain. The hack I steal puts something like it, whatever it was, back in scope.

No comments:

Post a Comment