欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript學(xué)習(xí)筆記(十七) 檢測瀏覽器插件代碼

 更新時間:2012年06月20日 20:17:48   作者:  
javascript學(xué)習(xí)筆記之檢測瀏覽器插件代碼,需要的朋友可以參考下
復(fù)制代碼 代碼如下:

//檢測非IE瀏覽器插件函數(shù)
function hasPlugin(name) {
name = name.toLowerCase();
for (var i=0 ; i < navigator.plugins.length ; i++ ) {
if (navigator.plugins[i].name.toLowerCase().indexOf(name) >-1) {
return true;
}
}
return false;
}

//檢測IE瀏覽器插件函數(shù)
function hasIEPlugin(name) {
try {
new ActiveXObject(name);
return true;
}
catch (ex) {
return false;
}
}
//檢測所有瀏覽器中的Flash
function hasFlash() {
var result = hasPlugin("Flash");
if (!result) {
result = hasIEPlugin("ShockwaveFlash.ShockwaveFlash");
}
return result;
}
//檢測所有瀏覽器中的QuickTime
function hasQuickTime() {
var result = hasPlugin("QuickTime");
if (!result) {
result = hasIEPlugin("QuickTime.QuickTime");
}
return result;
}

alert(hasFlash());
alert(hasQuickTime());

相關(guān)文章

最新評論