Jquery uses navigator.userAgent.indexOf to determine the browser type and performs some processing. It is recommended that friends who are learning Jquery study it to understand the ideas.
var userAgent = navigator.userAgent.toLowerCase(); // Figure out what browser is being used jQuery.browser = { version: (userAgent.match( /. (?:rv|it| ra|ie)[/: ]([d.] )/ ) || [])[1], safari: /webkit/.test( userAgent ), opera: /opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/. test( userAgent ) };
Jquery uses regular rules to match userAgent to determine the type and version of the browser. version---browser version msie- ---ie browser (Microsoft Internet Explorer) mozilla-Firefox browser opera--opera browser
How should we judge whether the current browser is IE6?