會員註冊 / 登入  |  電腦版  |  Jump to bottom of page

網頁程式設計 Web Development » 用戶端環境(瀏覽器軟體版本、安裝Plugin軟體、作業系統等)偵測

發表人: andowson, 七段學員
2009-12-29 08:03:26
Using the navigator object to detect client's browser
JavaScript - Browser detect

Java Plugin Detector

jQuery browser plugin detection 1.0.2可以偵測瀏覽器是否支援下列物件
Flash
Silverlight
PDF(checks if pdf mimetype is supported not limited to one PDF application)
Java
Quicktime
Windows Media Player
Shockwave
Real player

OS 版本判別

<script type="text/javascript">
<!--
// source: http://www9.plala.or.jp/oyoyon/html/script/platform.html
function detectOS() {
var os, ua = navigator.userAgent;
if (ua.match(/Win(dows )?NT 6\.1/)) {
os = "Windows 7"; // Windows 7
}
else if (ua.match(/Win(dows )?NT 6\.0/)) {
os = "Windows Vista"; // Windows Vista
}
else if (ua.match(/Win(dows )?NT 5\.2/)) {
os = "Windows Server 2003"; // Windows Server 2003
}
else if (ua.match(/Win(dows )?(NT 5\.1|XP)/)) {
os = "Windows XP"; // Windows XP
}
else if (ua.match(/Win(dows )? (9x 4\.90|ME)/)) {
os = "Windows ME"; // Windows ME
}
else if (ua.match(/Win(dows )?(NT 5\.0|2000)/)) {
os = "Windows 2000"; // Windows 2000
}
else if (ua.match(/Win(dows )?98/)) {
os = "Windows 98"; // Windows 98
}
else if (ua.match(/Win(dows )?NT( 4\.0)?/)) {
os = "Windows NT 4.0"; // Windows NT 4.0
}
else if (ua.match(/Win(dows )?95/)) {
os = "Windows 95"; // Windows 95
}
else if (ua.match(/Mac|PPC/)) {
os = "Mac OS"; // Macintosh
}
else if (ua.match(/Linux/)) {
os = "Linux"; // Linux
}
else if (ua.match(/(Free|Net|Open)BSD/)) {
os = RegExp.$1 + "BSD"; // BSD
}
else if (ua.match(/SunOS/)) {
os = "Solaris"; // Solaris
}
else {
os = "Unknown"; // Other OS
}
return os;
}
// -->
</script>

http://en.wikipedia.org/wiki/Microsoft_Windows#Timeline_of_releases

彈跳視窗支援/快顯封鎖程式偵測(Google, Yahoo, MSN工具列)
https://stock2.ubot.com.tw/ServiceProvider/WebTest/Default2.aspx

偵測Proxy=>檢查Header的HTTP_X_FORWARDED_FOR是否為空值
http://www.study-area.org/coobila/tutorial_320.html




會員註冊 / 登入  |  電腦版  |  Jump to top of page