惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - Waver

Tabbing problems in Firefox in Mac OS X [转] Data Flow Diagrams Tutorial [转] HTML Ampersand Character Codes 也谈完美跨域,JavaScript [转] - Waver Route命令使用详解[转] 使用塑料水瓶要当心 Extension Method for ENUM. Design Material Websites Summarization. - Waver How to cut through the complexity to find a solution. - Waver How to install flash player on Google Chrome browser? - Waver ADODB.Stream 对象的属性与方法 - Waver VB/VBScript读取和保存UTF-8文件方案 - Waver VB6: How To Convert UTF-8 Byte Arrays into Unicode Strings (and vice versa) Perl和OLE Automation Perl Unicode全攻略 ASP+COM 组件开发 SQL高级语法 无法去掉“关闭高级语言服务”解决方案! GCT 英语单词全部核心词汇A-Z
浏览器类型检测. (JavaScript) 【转】
Waver · 2009-11-01 · via 博客园 - Waver

<!--

/* OS / Browser Detect. Written by Joe McCormack. www.virtualsecrets.com */

var net_browser = 0;

function wbrowsertype() {

/*

__ net_browser flag values based on OS/Browser __

0 = Undetermined OS / Browser

17 = Undetermined OS / Browser

MAC OS:

2 = Unknown Browser

3 = Internet Explorer

4 = Safari

5 = Firefox

6 = Netscape

7 = Opera

8 = Camino

9 = Firebird

26 = Google Chrome

WINDOWS OS:

10 = Unknown Browser

11 = Internet Explorer

12 = Firefox

13 = Netscape

14 = Opera

15 = Camino

16 = Firebird

25 = Google Chrome

28 = Safari

UNKNOWN OS:

17 = Unknown Browser

18 = Safari

19 = Internet Explorer

20 = Firefox

21 = Netscape

22 = Opera

23 = Camino

24 = Firebird

27 = Google Chrome

*/

var btfound = 0; browser_detect = navigator.userAgent.toLowerCase();

if ((browser_detect.indexOf("konqueror") + 1)) { btfound = 1; net_browser = 1; }

if ((browser_detect.indexOf("mac_powerpc") + 1)) { btfound = 1; net_browser = 3; }

if (btfound == 0) {

// MAC OS

if ((browser_detect.indexOf("macintosh") + 1)) {

if ((browser_detect.indexOf("safari") + 1)) { btfound = 1; net_browser = 4; }

else if ((browser_detect.indexOf("firefox") + 1)) { btfound = 1; net_browser = 5; }

else if ((browser_detect.indexOf("netscape") + 1)) { btfound = 1; net_browser = 6; }

else if ((browser_detect.indexOf("opera") + 1)) { btfound = 1; net_browser = 7; }

else if ((browser_detect.indexOf("camino") + 1)) { btfound = 1; net_browser = 8; }

else if ((browser_detect.indexOf("firebird") + 1)) { btfound = 1; net_browser = 9; }

else if ((browser_detect.indexOf("chrome") + 1)) { btfound = 1; net_browser = 26; }

else { btfound = 1; net_browser = 2; }

}

// Windows OS

if ((browser_detect.indexOf("windows") + 1) && btfound == 0) {

if ((browser_detect.indexOf("msie") + 1)) { btfound = 1; net_browser = 11; }

else if ((browser_detect.indexOf("firefox") + 1)) { btfound = 1; net_browser = 12; }

else if ((browser_detect.indexOf("netscape") + 1)) { btfound = 1; net_browser = 13; }

else if ((browser_detect.indexOf("opera") + 1)) { btfound = 1; net_browser = 14; }

else if ((browser_detect.indexOf("camino") + 1)) { btfound = 1; net_browser = 15; }

else if ((browser_detect.indexOf("firebird") + 1)) { btfound = 1; net_browser = 16; }

else if ((browser_detect.indexOf("chrome") + 1)) { btfound = 1; net_browser = 25; }

else if ((browser_detect.indexOf("safari") + 1)) { btfound = 1; net_browser = 28; }

else { btfound = 1; net_browser = 10; }

}

// Unknown OS

if (btfound == 0) {

if ((browser_detect.indexOf("safari") + 1)) { net_browser = 18; }

else if ((browser_detect.indexOf("msie") + 1)) { net_browser = 19; }

else if ((browser_detect.indexOf("firefox") + 1)) { net_browser = 20; }

else if ((browser_detect.indexOf("netscape") + 1)) { net_browser = 21; }

else if ((browser_detect.indexOf("opera") + 1)) { net_browser = 22; }

else if ((browser_detect.indexOf("camino") + 1)) { net_browser = 23; }

else if ((browser_detect.indexOf("firebird") + 1)) { net_browser = 24; }

else if ((browser_detect.indexOf("chrome") + 1)) { net_browser = 27; }

else { net_browser = 17; }

}

}

/* In most cases, Google Chrome will behave the same as Firefox. If not you can remove these value overwrites. */

//if (net_browser == 25) { net_browser = 12; }

//else if (net_browser == 26) { net_browser = 5; }

//else if (net_browser == 27) { net_browser = 20; }

}

//-->