Client Detection Method Collation

Source: Internet
Author: User

Data reference "JavaScript advanced Programming"

Ability detection is one of the most common detection methods, it is not to detect a specific browser, but the ability to detect the browser,

The basic mode of capability detection is as follows: if (object.propertiinquestion) {return object.propertiinquestion;//using object.propertiinquestion} Ability detection needs to be aware of the most common features that are used to detect goals first, and the properties that are used in practice.

Ability testing and Finishing:

1, Event:

1  varEventutil={  2AddHandler:function(element,type,handler) {3        if(element.addeventlistener) {4Element.addeventlistener (Type,handler,false); 5}Else if(element.attchevent) {6Element.attachevent ("on" +Type,handler); 7}Else {    8element["on" +type]=handler; 9 }Ten }, OneRemoveHandler:function(element,type,handler) { A          if(element.removeeventlistener) { -Element.removeeventlistener (Type,handler,false);  -}Else if(element.datechevent) { theElement.datechevent ("on" +Type,handler);  -}Else {     -element["on" +type]=NULL;  - } + } -}


Not to be continued

Client Detection Method Collation

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.