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