Avatar of EOLNik
EOLNik
 asked on

How do I use Javascript to detect if an application is installed?

I am trying to use Javascript in a Web page to detect whether a DLL is installed. I'm doing this the most common way by creating an ActiveXObject like such: objClient = new ActiveXObject("pnllm.client");

The problem is, the browser settings have to be set to medium-low security to allow the scripting of ActiveX objects, etc. This is not desirable. Is there another way of detecting if an application or DLL is installed?
function checkClient() {
	var retVal = 0;
	var objClient = null;
	try {
		objClient = new ActiveXObject("pnllm.client");
		if (objClient != null)
		{
		    retVal = 1;
		} 
		else
		{
		    retVal = 0;
		}
		}	
                  catch(e)
		{
		    alert(e.description);
		}
	
	
	}

Open in new window

JavaScript

Avatar of undefined
Last Comment
b0lsc0tt

8/22/2022 - Mon
glcummins

Javascript is designed to be encapsulated in the browser environment, and not to be able to reach out into the rest of the OS. If this were allowed, it would be a major security hole.

ActiveX may allow some such things, but of course it will only work in IE. Secure browsers such as Firefox would not allow such calls to be made.
EOLNik

ASKER
I understand, but this does not answer my question. How else do I detect if an application is present on a client machine?
glcummins

From a browser, you don't. That's the point. IE may be able to via ActiveX, but none of the others.

The only other option you have is to convince the user to install a custom application that will send such data back to your server.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
Morcalavin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
EOLNik

ASKER
I cannot use the java applet approach as I am using AJAX to pass the Javascript value back to my server-side code. I don't think Java applets can interact with ASP.Net server-side scripts using AJAX.

How about simply accessing the file system via javascript to see if the DLL is present in %WINDIR%\system32?
SOLUTION
glcummins

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
glcummins

>> simply accessing the file system

Do you understand why this is a security risk? What if a user stored credit card information, passwords, or any other sensitive information on the system. Do you really think it is a good idea for a browser to allow a remote website to access such information?
EOLNik

ASKER
Of course I understand the security risk. So what you are saying, essentially, is that THERE IS ABSOLUTELY NO OTHER WAY TO DETERMINE VIA JAVASCRIPT IF AN APPLICATION IS INSTALLED ON A CLIENT MACHINE. Yes or no will suffice.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Morcalavin

It's been said.  Twice(more?).

Without Active-X and the appropriate security, it is not possible for javascript to access the local filesystem.  It would be a HUGE security nightmare if every website you ever visited could read your files.

no.  No.  nO.  NO.
EOLNik

ASKER
I think I got it now... No?

Thanks for the replies.
b0lsc0tt

EOLNik,

The info above is correct and it seems like you are clear on it.  If you need an option the Java applet was mentioned.  There is no reason your ASP.NET server script couldn't get a response from it (probably using Javascript in between) even if you use AJAX.  Another option, but would only work in IE, is your own, custom ActiveX object.  All of these things still depend on the user to download, trust and allow but could do this, especially if it is a signed script (as was mentioned above).  Since .NET and ActiveX are MS technologies I am sure they could work well enough together to let you do this but even just a Java applet could make its own request to the server or write some html for the Javascript in the AJAX to use.

Nothing easy though.  Thank heavens because way too many would abuse it, even if you wouldn't and have a great reason to wish you could do this easy. :)  Let me know if you have any questions or need more information.

b0lsc0tt
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
b0lsc0tt

kodiakbear,

Oops.  Sorry for causing you a little work.  It seems like there was a tie with the post to close and I came in second. :(  Thanks for finalizing this and all of your time and help hereg.

bol
BTW - No objection to your recommendation