[jifty-devel] Re: [Jifty-commit] r2507 - in jifty/trunk: share/web/static/js

Thomas Sibley trs at bestpractical.com
Tue Jan 16 17:44:43 EST 2007


Jesse Vincent wrote:
> I thought that there was a nice browserdetect library out there. No?

When I originally added this to BTDT, the code below was a modified form 
of some doc about how to do browser detection right.  It was the best 
thing at the time, I think.  There does appear to be a BrowserDetect lib 
out there now:

http://www.quirksmode.org/js/detect.html

Dunno how long it's been there.

> 
> On Tue, Jan 16, 2007 at 05:34:40PM -0500, jifty-commit at lists.jifty.org wrote:
>> Author: trs
>> Date: Tue Jan 16 17:34:39 2007
>> New Revision: 2507
>>
>> Modified:
>>    jifty/trunk/   (props changed)
>>    jifty/trunk/share/web/static/js/jifty_utils.js
>>
>> Log:
>>  r18891 at zot:  tom | 2007-01-16 17:32:21 -0500
>>  Add browser detection from BTDT to Jifty (where it should have been)
>>
>>
>> Modified: jifty/trunk/share/web/static/js/jifty_utils.js
>> ==============================================================================
>> --- jifty/trunk/share/web/static/js/jifty_utils.js	(original)
>> +++ jifty/trunk/share/web/static/js/jifty_utils.js	Tue Jan 16 17:34:39 2007
>> @@ -73,6 +73,35 @@
>>  
>>      isMSIE: false,
>>  
>> +    _browser: null,
>> +    browser: function() {
>> +        if ( Jifty.Utils._browser ) return Jifty.Utils._browser;
>> +
>> +        if ( Jifty.Utils.isMSIE ) {
>> +            Jifty.Utils._browser = "msie";
>> +            return "msie";
>> +        }
>> +
>> +        var browser = "unknown";
>> +        
>> +        if      ( Jifty.Utils._checkUAFor("konqueror"))   browser = "konqueror";
>> +        else if ( Jifty.Utils._checkUAFor("safari"))      browser = "safari";
>> +        else if ( Jifty.Utils._checkUAFor("omniweb"))     browser = "omniweb";
>> +        else if ( Jifty.Utils._checkUAFor("opera"))       browser = "opera";
>> +        else if ( Jifty.Utils._checkUAFor("webtv"))       browser = "webtv";
>> +        else if ( Jifty.Utils._checkUAFor("icab"))        browser = "icab";
>> +        else if ( Jifty.Utils._checkUAFor("msie"))        browser = "msie";
>> +        else if ( !Jifty.Utils._checkUAFor("compatible")) browser = "mozilla";
>> +        
>> +        Jifty.Utils._browser = browser;
>> +        return browser;
>> +    },
>> +
>> +    _ua: navigator.userAgent.toLowerCase(),
>> +    _checkUAFor: function(str) {
>> +        return Jifty.Utils._ua.indexOf( str ) + 1;
>> +    },
>> +
>>      findScreenHeight: function() {
>>          if ( window.innerHeight ) {
>>              return window.innerHeight;
>> _______________________________________________
>> Jifty-commit mailing list
>> Jifty-commit at lists.jifty.org
>> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-commit
>>
> 



More information about the jifty-devel mailing list