jquery的jquery c.browser msie undefined的问题解决办法
来源:互联网 发布:火车票抢购软件 编辑:程序博客网 时间:2024/06/07 02:04
参考一下内容:
http://blchen.com/jquery-can-not-read-property-msie-of-the-undefined-error-solution/
转载:
[jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
最近把一个项目的jQuery升级到最新版,发现有些页面报如下错误
Cannot read property 'msie' of undefined
上jQuery网站上搜了一下,原因是$.browser这个api从jQuery1.9开始就正式废除,js代码里只要用到$.browser就会报这个错。具体说明参见jQuery官方说明。
楼主顺便扩展阅读了一下,发现jQuery 1.9把所有在之前版本里标记为deprecated的api都正式删除了,彻底不再向后兼容。对于升级到最新jQuery的童鞋而言,这意味着得花费一些额外的时间把代码升级使用新的api,或者自己另外实现这些被删除的方法。幸运的是,jQuery团队意识到了这个break change带来的种种不便,推出了一个叫jQuery Migrate插件,用于能够自动恢复那些在最新版本里被废弃的API。只要引用了这个插件,已有的js代码无须改动就能和最新的jQuery库一起正常运行。
下面是具体的解决方法,首先要下载jQuery Migrate插件,然后在引用jQuery js的地方之后加上对jQuery Migrate js文件的引用即可。
<script src="http://code.jquery.com/jquery-1.10.2.js"></script><script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
用jQuery Migrate的解决方法虽然简单无脑,但是会导致增加一个额外的js库。对于不喜欢增加额外js库的童鞋,可以参考这篇博客提到的另外一种解决方法,请注意下面代码加载位置为:jQuery文件之后,$.browser的代码之前。
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;}})();
0 0
- jquery的jquery c.browser msie undefined的问题解决办法
- [jQuery]Cannot read property ‘msie’ of undefined错误的解决方法
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
- [JQUERY] CANNOT READ PROPERTY ‘MSIE’ OF UNDEFINED错误的解决方法
- [jQuery] Cannot read property ‘msie’ of undefined jQuery 1.9不支持 $.browser
- jquery.Jcrop中解决jQuery不支持$.browser的办法
- [Jquery]Cannot read property 'msie' of undefined
- 使用jquery插件报错:$.browser is undefined的解决方法
- jQuery browser msie 判断 浏览器 ie6 bug jQuery中浏览器版本判断的一个BUG,此BUG已影响到jqModal,thickbox等多个jQuery插件的应用
- jquery.getJSON的缓存问题解决办法
- 关于jQuery版本的兼容性--使用jquery插件报错:$.browser is undefined的解决方法
- JQuery之——使用jquery插件报错:TypeError:$.browser is undefined的解决方法
- Jquery错误:Cannot read property ‘msie’ of undefined
- Uncaught TypeError: Cannot read property 'msie' of undefined jQuery
- Java高性能集合类 ConcurrentLinkedHashMap demo
- Minimum Depth of Binary Tree
- 黑马程序员_java12_java中的异同
- #1015 : KMP算法
- Android判断当前系统语言
- jquery的jquery c.browser msie undefined的问题解决办法
- 【论坛】网络与通信大板上线公告
- 老式后门之美:五种复古远程控制工具(含下载)
- android studio给项目添加第三方库的方法
- MongoDB删除字段和部分字段查询
- Android Fragment生命周期
- U8SDK问答及汇总
- Maximum Depth of Binary Tree
- Fragment add 和replace的区别