Detect from browser if specific application is installed

前端 未结 5 1868
一生所求
一生所求 2020-12-02 17:42

We have an advanced webpage (ASP.NET, C#), and a application which needs to be installed on the client computer in order to utilize the webpage to its fullest. The applicati

5条回答
  •  清歌不尽
    2020-12-02 18:24

    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.

    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
    }
    

    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;
            }
    };
    

    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
    

提交回复
热议问题