Detect from browser if specific application is installed

前端 未结 5 1840
一生所求
一生所求 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:19

    When installing your client-side app you could modify the browser configuration to include another request header in HTTP requests and then have the server code look for that header, for example as a supported mime type using the following registry key (for Internet explorer)

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\
                                                          Internet Settings\Accepted Documents
    

    I am not sure if Opera and FF use this same key, but they likely have similar configuration options, but this should at least get you on the right track.

    0 讨论(0)
  • 2020-12-02 18:20

    Expose the trayapp (assuming this as a Managed app) as COM object. You could then use the tag with the GUID and trap errors when not found or use the ActiveXobject with the progid to detect if it's installed.

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2020-12-02 18:30

    Good idea from @JohnFx.

    Another way to tackle this would be to install an ActiveX control or Browser plug-in with the trayapp installation. You could then access this in a similar way to that done when checking the version of Flash available.

    0 讨论(0)
  • 2020-12-02 18:34

    Well the method that was mentioned by "some" is very common but there's also other methods for example if the application is listening locally on a port it can be detected from the browser which is very common for security solutions because have some sort of local proxy to filter the traffic. I actually made a video a while ago about using this technique to detect avast anti-virus you can watch it here:

    https://www.youtube.com/watch?v=39_Nd8oiEAk

    0 讨论(0)
提交回复
热议问题