Detect from browser if specific application is installed

11,194

Solution 1

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

Solution 2

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.

Solution 3

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

Solution 4

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.

Share:
11,194

Related videos on Youtube

Frode Lillerud
Author by

Frode Lillerud

Educated as a space engineer, but been working in the IT-sector since 2004. Mostly a C# guy.

Updated on April 15, 2022

Comments

  • Frode Lillerud
    Frode Lillerud about 2 years

    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 application is a tray app, and has primarily two tasks. Detect when certain events happen on the webserver (for instance invited to a meeting, or notify of an upcoming meeting). The other task the trayapp has is to use a custom protocol (trayapp://) to perform some ajax calls back to the server.

    One problem we have is how to determine if the application is installed on the local machine or not. Now the user has to tick a checkbox to inform the website that the application is installed, and that it's safe to call the trayapp:// url calls.

    Is there any way, for instance through a JavaScript or similar to detect if our application is installed on the local machine?

    The check needs to work for IE, FF and Opera browsers.

  • Eduardo Campañó
    Eduardo Campañó over 15 years
    maybe in IE he can try a CreateObject() of a registered ActiveX also from javascript to check if the application is installed
  • ᴍᴀᴛᴛ ʙᴀᴋᴇʀ
    ᴍᴀᴛᴛ ʙᴀᴋᴇʀ about 9 years
    I'm very interested in this approach but can't find any clear instruction on how. Do you have an example of how this can be set cross-browser?
  • xr280xr
    xr280xr over 8 years
    That looks like a good idea. How can the tray app listen on a port and handle requests?
  • Fady Mohamed Othman
    Fady Mohamed Othman over 8 years
    It can simply open a socket on a certian port and serve an image if you can load the image then the application is there. Also it can repond with json and allow a certain domain to read that json.
  • xr280xr
    xr280xr over 8 years
    Thank you. It looks like HttpListener class might also be useful here.