浏览器cannot read property 'msie' of undefined的解决方法

首页 编程分享 JQUERY丨JS丨VUE 正文

袅袅牧童 转载 编程分享 2017-06-11 20:19:30

简介 浏览器cannot read property 'msie' of undefined的解决方法


练习demo,版本升级很容易有错误…,百度和Google

Uncaught TypeError: Cannot read property 'msie' of undefined

谷歌:

jQuery.browser() removed

The jQuery.browser() method has been deprecated since jQuery 1.3 and is removed in 1.9. If needed, it is available as part of the jQuery Migrate plugin. We recommend using feature detection with a library such as Modernizr.

意思就是jQuery.browser()在后版本不支持了,需要引入一个js插件来进行兼容处理;好吧,在引入一个js文件就可以了: 
下载地址: 
jquery-migrate-1.3.0.js

下载这个js文件,然后放在jquery文件下面:

  <script src="jquery-2.1.4.js"></script>
  <script src="jquery-migrate-1.3.0.js"></script>

原文链接


如以上无效,请参考以下链接: 
Uncaught TypeError: Cannot read property ‘msie’ of undefined - jQuery tools

//在代码中加上
<script type="text/javascript">
    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;
        }
    })();
</script>

转载链接:https://blog.csdn.net/niexia_/article/details/78021821?locationNum=2&fps=1


Tags:


本篇评论 —— 揽流光,涤眉霜,清露烈酒一口话苍茫。


    声明:参照站内规则,不文明言论将会删除,谢谢合作。


      最新评论




ABOUT ME

Blogger:袅袅牧童 | Arkin

Ido:PHP攻城狮

WeChat:nnmutong

Email:nnmutong@icloud.com

标签云