http://qs321.pair.com?node_id=172615


in reply to Re: Short and Sweet Browser Detection
in thread Short and Sweet Browser Detection

But... You'll still need to loop through, trying a match with each until you find the user agent.

Perhaps looking for the element in user_agent that contains a slash, then stripping the version number, and using that as an index into a hash. i.e. "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" becomes "Mozilla/4.0", then "Mozilla" which is used as a key in the hash.

But then that may be a bit of overkill unless you're planning on matching every possible browser/wap device. Even then, the list would be under a couple hundred.