因为图方便,抄了别人写的一个jquerry插件,运行时“var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed'; ”报了Uncaught TypeError: Cannot read property 'msie' of undefined的错误。

网上搜了一下,http://stackoverflow.com/questions/14923301/uncaught-typeerror-cannot-read-property-msie-of-undefined-jquery-tools里面说在jquerry1.9以后,browser属性已经被移除。
上jquerry官网查了一下API,确实已经移除。官网建议使用Modernizr库。
不希望再引入其它库,再上网找其它的解决方案,关键字:jquery1.9浏览器类型。
下面这个是可行的(出处:http://blog.csdn.net/lyc_2011_acm/article/details/8749177

判断浏览器类型:
$.browser.mozilla = /firefox/.test(navigator.userAgent.toLowerCase());
$.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
$.browser.opera = /opera/.test(navigator.userAgent.toLowerCase());
$.browser.msie = /msie/.test(navigator.userAgent.toLowerCase());
等号后面的表达式返回的就是 true/false, 可以直接用来替换原来的 $.browser.msie 等。

检查是否为 IE6:
// Old
if ($.browser.msie && 7 > $.browser.version) {}
// New
if ('undefined' == typeof(document.body.style.maxHeight)) {}


检查是否为 IE 6-8:
if (!$.support.leadingWhitespace) {}

Uncaught TypeError: Cannot read property 'msie' of undefined的更多相关文章

  1. easyui使用时出现这个Uncaught TypeError: Cannot read property 'combo' of undefined

    easyui使用时出现这个Uncaught TypeError: Cannot read property 'nodeName' of undefined 最后检查发现是必须给select一个id,光 ...

  2. reactjs Uncaught TypeError: Cannot read property 'location' of undefined

    reactjs Uncaught TypeError: Cannot read property 'location' of undefined reactjs 路由配置 怎么跳转 不成功 国内搜索引 ...

  3. index.js:13 Uncaught TypeError: Cannot read property 'split' of undefined

    使用 webpack 编译 Vue 项目时出现报错: index.js:13 Uncaught TypeError: Cannot read property 'split' of undefined ...

  4. Uncaught TypeError: Cannot read property ‘split’ of undefined

    问题 :Uncaught TypeError: Cannot read property ‘split’ of undefinedat HTMLLIElement. split()切割的问题 因为遍历 ...

  5. SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论 SignalR 简单示例 通过三个DEMO学会SignalR的三种实现方式 SignalR推送框架两个项目永久连接通讯使用 SignalR 集线器简单实例2 用SignalR创建实时永久长连接异步网络应用程序

    SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论   异常汇总:http://www ...

  6. DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined

    DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined 原因:table 中定义的列和aoColumns ...

  7. underscore.js定义模板遇到问题:Uncaught TypeError: Cannot read property 'replace' of undefined

    代码正确缩进位置如下, extend "layout" block 'content',-> div ->'nihao' script id:"Invoice ...

  8. Uncaught TypeError: Cannot read property 'decimalSeparator' of undefined

    1.错误描述 jquery.jqGrid.min.js:477 Uncaught TypeError: Cannot read property 'decimalSeparator' of undef ...

  9. 【jQuery】jquery中 使用$('#parentUid').attr(parentUid);报错jquery-1.11.3.min.js:5 Uncaught TypeError: Cannot read property 'nodeType' of undefined

    jquery中 使用$('#parentUid').attr(parentUid);报错jquery-1.11.3.min.js:5 Uncaught TypeError: Cannot read p ...

随机推荐

  1. 字符编码笔记:ASCII,Unicode和UTF-8(转载)

    作者: 阮一峰 日期: 2007年10月28日 今天中午,我突然想搞清楚Unicode和UTF-8之间的关系,于是就开始在网上查资料. 结果,这个问题比我想象的复杂,从午饭后一直看到晚上9点,才算初步 ...

  2. chattr和lsattr

    这两个命令是和权限有关 1.chattr +i carlton.txt 对carlton.txt文件进行锁定,谁也不能进行任何修改,取消的话可以chattr -i carlton.txt 就可以 2. ...

  3. 繁星——jquery的data()方法

    今天在看JQuery文档的时候偶然看到了data()方法,觉得挺好用的,这里做个记录. 这个方法用于在元素上存放数据,返回jQuery对象.在文档中提到V1.4.3 新增用法NEW data(obj) ...

  4. 15个实用的jQuery代码片

    (function($) { var cache = []; // Arguments are image paths relative to the current page. $.preLoadI ...

  5. hadoop运行原理之Job运行(五) 任务调度

    接着上篇来说.hadoop首先调度辅助型task(job-cleanup task.task-cleanup task和job-setup task),这是由JobTracker来完成的:但对于计算型 ...

  6. gbk与utf-8转换

    linux: #include <iconv.h> int code_convert(char *from_charset,char *to_charset,char *inbuf,int ...

  7. 带转义符的json解释

    1.json数组:jsonData.取json数组中message的appid的值.例子: var jsonData = { "code":"200", &qu ...

  8. C#将字节流加密解密

    public class Encrypt { public static byte[] ToEncrypt(string encryptKey, byte[] P_byte_data) { try { ...

  9. pyinstaller 用法

    参考:http://pythonhosted.org/PyInstaller/#installing-pyinstaller 1.下载pyinstaller和PyWin32  目前pyinstalle ...

  10. ie8 window.open导出文件报错

    js创建一个<a>元素hiddenElementhiddenElement.setAttribute('href','')hiddenElement.setAttribute('targe ...