Uncaught TypeError: Cannot read property ‘msie’ of undefined when upgrading to WordPress 5.5


Uncaught TypeError: Cannot read property ‘msie’ of undefined when upgrading to WordPress 5.5

Recently when upgrading an older site to WordPress 5.5 I noticed a javascript error in the console that read Uncaught TypeError: Cannot read property ‘msie’ of undefined.

If you have a plugin or script that relied on an older version of jQuery it will no longer work because WordPress updated their jQuery version. In order to fix add this to the top of your scripts file

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;
    }
})();

 



Written by: Jake Lett
I share digital marketing tips and HubSpot tutorials to help marketers and business owners grow their business.

Topic:

Related posts

Tags:

Want to Get Email Updates of New Articles?

Join My Email Newsletter