因为图方便,抄了别人写的一个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. PHP分页类,生成分页html字符串

    <?php namespace Common\Common; /** * 该Page类主要有两个方法:showPageString(), showPageStringAsAJAX() * * s ...

  2. mydumper linux mysql 备份利器

    1 官网 https://launchpad.net/ 2 安装使用参考网站   http://www.cnblogs.com/digdeep/p/4925560.html

  3. Spring Quartz

    Spring  Quartz Quartz是一个强大的企业级任务调度框架,Spring中继承并简化了Quartz,下面就看看在Spring中怎样配置Quartz: 首先我们来写一个被调度的类: pac ...

  4. 【Python④】python恼人的字符串,格式化输出

    恼人的字符串 计算机只能处理数字,如果要处理文本,就必须先把文本转换为数字才能处理.由于计算机是美国人发明的,因此,最早只有127个字母被编码到计算机里,也就是大小写英文字母.数字和一些符号,这个编码 ...

  5. thunkify 模块

    function thunkify(fn){ assert('function' == typeof fn, 'function required'); return function(){ var ...

  6. Ubuntu14.04使用apt-fast来加快apt-get下载的教程

    代码如下: $ sudo add-apt-repository ppa:saiarcot895/myppa $ sudo apt-get update $ sudo apt-get install a ...

  7. C++小项目:directx11图形程序(六):cameraclass

    cameraclass是一个相机类,它的作用是生成非常重要的观察矩阵.本小节涉及到一点数学知识,相对前面需要只是填充,调用,算是比较有趣的吧. cameraclass.h #pragma once # ...

  8. 正则匹配中文 UTF-8 & GBK

    在php 中: //GB2312汉字字母数字下划线正则表达式 GBK: preg_match("/^[".chr(0xa1)."-".chr(0xff).&qu ...

  9. 支付宝APP支付后台参数生成Java版(一)

    一.支付参数组装: String[] parameters={ "service=\"mobile.securitypay.pay\"",//固定值 " ...

  10. SQLServer存储过程和触发器学习记录及简单例子

     一.存储过程 存储过程即为能完成特定功能的一组SQL语句集.如果需要对查出的多条数据进行操作的话,这里需要理解游标(CURSOR)的概念,对于oracle有for each row命令,可以不用游标 ...