Cannot read property ‘msie’ of undefined错误原因以及解决方案
最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property ‘msie’ of undefined。上jQuery网站上搜了一下,$.browser这个api从jQuery1.9开始就被废除了,所以js代码里只要用到$.browser就会报这个错。
深入挖掘了一下,发现jQuery1.9里把所有以前版本里标记为deprecated的API给正式删除了,可谓壮士断臂。对于升级到最新jQuery的开发者而言,这意味着得花费一些额外的时间把代码升级使用新的api或者自己实现那些在jQuery库里被删除的方法。幸运的是,jQuery团队考虑到了这个改动做给开发人员带来的麻烦,推出了一个插件jQuery Migration,使用这个插件自动恢复那些在最新版本里之后被废弃或者删除的API,从而让已有的js代码无须改动就能和最新的jQuery库一起正常运行。
下面是具体的解决方法,先下载最新的jQuery Migration,然后在引用jQuery的地方之后加上一行对jQuery Migration的引用即可。
<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>
Cannot read property ‘msie’ of undefined错误原因以及解决方案的更多相关文章
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法 --转
初用Yii的srbac模块.出现 Cannot read property ‘msie’ of undefined 错误.上网查询,找到如下的文章.使用文末的打补丁的方法,成功搞定.感谢. ===== ...
- [转载][jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
参考 [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法 ---------------------------------------- ...
- [jQuery1.9]Cannot read property ‘msie’ of undefined错误的解决方法
原文:[jQuery1.9]Cannot read property 'msie' of undefined错误的解决方法 $.browser在jQuery1.9里被删除了,所以项目的js代码里用到$ ...
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property ‘msie’ of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...
- jquery升级到新版本报错[jQuery] Cannot read property ‘msie’ of undefined错误的解决方法(转)
最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property 'msie' of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...
- Uncaught TypeError: Cannot set property 'f7View' of undefined 错误原因
// 添加视图var mainView = myApp.addView('.view-main', { // 因为我们要用动态的导航栏,我们需要使它的这一观点: dynamicNavbar: true ...
- jquery错误: Cannot read property ‘msie’ of undefined
背景 Web application, 引用了jquery 1.10.2和fancybox 1.3.4 现象 访问页面遭遇Cannot read property ‘msie’ of undefine ...
- Uncaught TypeError: Cannot read property 'msie' of undefined
因为图方便,抄了别人写的一个jquerry插件,运行时“var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ...
- 获取判断IE版本 TypeError: Cannot read property 'msie' of undefined
注意:以下方法只适用于IE11 以下: TypeError: Cannot read property 'msie' of undefined jquery1.9去掉了 $.browser 所以报错 ...
随机推荐
- vue+element 切换正式和测试环境
1.package.json { "name": "element-starter", "description": "A Vue ...
- nova-api中ExtensionManager的构造
源码版本:H版 nova/api/openstack/__init__.py APIRouter类: def __init__(self, ext_mgr=None, init_only=None): ...
- 翻译: 星球生成 II
翻译: 星球生成 II 本文翻译自Planet Generation - Part II 译者: FreeBlues 以下为译文: 概述 在前一章 我解释了如何为星球创建一个几何球体. 在本文中, 我 ...
- nginx client ip配置
server { listen 80; server_name localhost; location /{ root html; index index.html index.htm; proxy_ ...
- Hadoop2.6.0在CentOS 7中的集群搭建
我这边给出我的集群环境是由一台主节点master和三台从节点slave组成: master 192.168.1.2 slave1 192.168.1.3 slave2 ...
- input新类型详解
http://www.webhek.com/post/html5-input-type.html
- 微服务深入浅出(10)-- Docker
概念 1.Docker引擎 一个运行在服务器上的后台进程 2.Docker客户端 分为两种:CLI和RestAPI,与Docker引擎交互 3.Docker镜像 类似于我们使用的光盘,将程序打包到Do ...
- 【leetcode 简单】 第七十五题 第一个错误的版本
你是产品经理,目前正在带领一个团队开发新的产品.不幸的是,你的产品的最新版本没有通过质量检测.由于每个版本都是基于之前的版本开发的,所以错误的版本之后的所有版本都是错的. 假设你有 n 个版本 [1, ...
- Pycharm和IntelliJ IDEA激活 2017.3.x版本
PyCharm 2017.3.3 (Professional Edition) 已经屏蔽了http://www.imsxm.com/ http-server激活方式,我根据参考教程搭建了一个,如有 ...
- 生成Word/ATU报表提示 font family not found
1.先从你本机 C:\Windows\Fonts 拷贝或者网络上下载你想要安装的字体文件(*.ttf文件)到 /usr/share/fonts/chinese/TrueType 目录下(如果系统中没有 ...