Uncaught Typeerror:cannot Read Property ' Msie ' of undefined

Source: Internet
Author: User

Because the diagram is convenient, copied someone else wrote a Jquerry plug-in, run-time "var pos = ($.browser.msie && parseint ($.browser.version) <= 6)? ' Absolute ': ' fixed '; "Reported uncaught Typeerror:cannot Read property ' msie ' of undefined error.

Search the Internet, http://stackoverflow.com/questions/14923301/. Uncaught-typeerror-cannot-read-property-msie-of-undefined-jquery-tools said that after jquerry1.9, the browser attribute has been removed. On the Jquerry official website looked up the API, indeed has been removed. The official website recommends using the Modernizr library. Do not want to introduce another library, and then surf the Internet to find other solutions, keywords: jquery1.9 browser type. The following is possible (source: http://blog.csdn.net/lyc_2011_acm/article/details/8749177)

To determine the browser type:
$.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 ());
The expression after the equal sign returns the True/false, which can be used directly to replace the original $.browser.msie.

Check if it is IE6:
Old
if ($.browser.msie && 7 > $.browser.version) {}
New
if (' undefined ' = = typeof (Document.body.style.maxHeight)) {}


Check if it is IE 6-8:
if (!$.support.leadingwhitespace) {}

Uncaught Typeerror:cannot Read Property ' Msie ' of undefined

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.