Reputation: 20684
I am working in an asp.net application. From an asp.net webpage, the user can download our special file and then run it. the file will be associated with an application previously installed on the client machine.
Off course, if the application was not installed on the local machine, they can not run the file.
I wonder would it be possible to detect if our application has installed on the local machine or not. if not a popup or a message is shown on the machine and ask them to install our software first.
Something like Flash, the browser can detect that if Flash is not installed on the local machine. It will ask the user to install download Flash and install it.
Thanks in advance.
Upvotes: 1
Views: 1652
Reputation: 18652
One way you could have your web app detect whether your application is installed locally is if your app makes a change to the browser's User-Agent
or Accept
HTTP headers.
The way you do that for each browser is different. For IE, you do it by changing a registry setting.
It's a fragile mechanism, though, and very invasive, and I don't recommend it.
Alternatively, you could install a small browser plug-in along with your app, and use the HTML <object>
tag to see if it's there or not.
Upvotes: 2
Reputation: 1039588
I wonder would it be possible to detect if our application has installed on the local machine or not.
Wonder no more, for obvious security reasons that's not possible.
The way things like Flash and Silverlight work is that they are browser plugins. So the browser when it encounters the <object>
or <embed>
tags to embed this plugin it knows whether it is installed or not and it uses the alternate content specified. It's already part of HTML. Take a look for example of how a sample Silverlight application is embedded:
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/Foo.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40818.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object>
<iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
</div>
See the link to download the plugin which the browser displays in case it doesn't understand the application/x-silverlight-2
type (which obviously is the case if it is not installed).
But detecting whether some programs are installed on the client computer from a web application is out of question. That would just be a huge security hole.
So just ask your users gently => explain them that in order to use your website they need to download, install and run some software on their computers at their own risk.
Upvotes: 2
Reputation: 16812
You would need to use an ActiveX control or browser plugin (Firefox, Chrome, etc) to check if the client is installed.
Upvotes: 0