Определения браузера в JavaScript

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4,00 out of 5)
Loading ... Loading ...

Определения браузера от Gareth Heyes:

?View Code JAVASCRIPT
//Firefox detector 2/3 by DoctorDan
FF=/a/[-1]=='a'
 
//Firefox 3
FF3=(function x(){})[-5]=='x'
 
//Firefox 2
FF2=(function x(){})[-6]=='x'
 
//IE
IE='\v'=='v'
 
//Safari
Saf=/a/.__proto__=='//'
 
//Chrome
Chr=/source/.test((/a/.toString+''))

Всё вместе:

?View Code JAVASCRIPT
B=(function x(){})[-5]=='x'?'FF3':(function x(){})[-6]=='x'?'FF2':'\v'=='v'?'IE':/a/.__proto__=='//'?'Saf':/s/.test(/a/.toString)?'Chr':'Op';

Метки:

Пятница, 30 января 2009 JavaScript
You can follow any responses to this entry through the RSS 2.0 feed.

Ответить

Январь 2009
Пн Вт Ср Чт Пт Сб Вс
    Фев »
 1234
567891011
12131415161718
19202122232425
262728293031