且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从浏览器检测是否存在特定的应用程序安装

更新时间:2023-01-01 22:21:52

如果要检测的JavaScript在浏览器中,你也许可以使用集合navigator.plugins。它与Firefox,Opera和Chrome浏览器,但遗憾的是没有与IE浏览器。

If you want to detect with javascript inside the browser, you can probably use the collection "navigator.plugins". It works with Firefox, Opera and Chrome but unfortunately not with IE.

更新: 在FF,Opera和Chrome浏览器,你可以很容易地测试它是这样的:

Update: In FF, Opera and Chrome you can test it easily like this:

if (navigator.plugins["Adobe Acrobat"]) {
// do some stuff if it is installed
} else {
// do some other stuff if its not installed
}

更新#2: 如果是在IE中的ActiveX对象,你可以测试是否存在通过使用这样的:

Update #2: If it is an ActiveX object in IE you can test if it exists by using something like this:

function getActiveXObject(name){
    	try{
    		return new ActiveXObject(name);
    	}
    	catch(err){
    		return undefined;
    	}
};

有关IE另一种方法是类似于JohnFx建议的东西(我发现它这里和有没有测试过):

Another approach for IE is something similar to what JohnFx suggested (I found it here and have not tested it):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Internet
Settings\User Agent\Post Platform