On Aug 31, 2006, at 4:43 PM, Dave Cardwell wrote:

> Corey Jewett wrote:
>> I just now looked into doing so, but I think it will grow the core's
>> file size too much. Nice plugin though.
>
> // As of jQuery 1.0.1[1] the relevant code is:
> var b = navigator.userAgent.toLowerCase();
> jQuery.browser = {
>      safari: /webkit/.test(b),
>      opera: /opera/.test(b),
>      msie: /msie/.test(b) && !/opera/.test(b),
>      mozilla: /mozilla/.test(b) && !/compatible/.test(b)
> };
>
>
> // Browser detection could be improved thusly:
> var b = navigator.userAgent.toLowerCase(),
>      v = navigator.vendor.toLowerCase(),
>      sa = /apple/.test(v),

Why do you prefer this over /webkit/ ?

>      op = !sa && window.opera != undefined,

I thought about using this. Any Opera users have a reason not to?

>      ie = !sa && !op && /msie/.test(b),
>      mz = !sa && !op && !ie && /gecko|mozilla/.test(b);
>
> jQuery.browser = {
>      safari: sa,
>      opera: op,
>      msie: ms,
>      mozilla: mz
> };
>
>
> It wouldn't be quite as robust as jQBrowser[2], but would certainly  
> be a
> lot more reliable than it currently is, and for little extra code.   
> The
> above is a proof of concept, not tested, and could probably be  
> tidied up
> a bit.
>
> [1] http://jquery.com/src/jquery-1.0.1.js
> [2] http://davecardwell.co.uk/geekery/javascript/jquery/jqbrowser/
>
>
> Best wishes,
> Dave Cardwell ~ http://davecardwell.co.uk/
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to