Check if exe is installed on client machine - javascript

I have a windows form application which opens up from a web browser using uri protocol scheme.
I want to check if this windows form application is first installed on the user machine. Is there any way using javascript or jquery to check if the specific application is installed on the user machine first, and based on the installation show either the launch button or a download button.
I know that reading application exe from browser is not good from security standpoint, but if I am able to get this, I can show appropriate message to the user.
So any ways to find out using client side code, or reading specific registry based on my msi package application id saved in registry from client side or is it even recommended to have such a code in place?
Any advice or suggestions would be great.
Thanks in advance!

Checking exe file path can help.
If System.IO.File.Exists("C:\Program Files\notepad.exe") = True then
Msgbox "exe exist"
end if

Make your win forms application write some registry entries upon installation, something like the exe file location. then check for the those entries and decide to start the download URI or the launch URL browser.

Related

Is it possible to using web api and open a local folder? [duplicate]

We are currently looking at porting a enterprise silverlight application over to html5. The major roadblock that we have hit is the ability to open files from the user's local disk. Currently they have a document library which just links to files on their computer that they can open from within the app and view or print out. All that I read is that you can only access the local sandbox of the web app with the html5 file api's. We want to load these files from code.
Does anyone know of any workarounds to this?
Thanks
There is no way for html5 to access local file without user selection. But FSO: FileSystemObject works for IE and MAYBE could be regarded as a work around. But still there are some requirements to meet.
It is possible to use chrome's filesystem API to access files on a users local filesytem. So you'd have to be willing to make this a chrome only application.
Using java you can create a "Signed" applet which has access to the local filesystem. (if the applet is signed you can request filesystm permissions)
then there is a tutorial for accessing methods of your java code directly from javascript here: http://docs.oracle.com/javase/tutorial/deployment/applet/invokingAppletMethodsFromJavaScript.html
you should be able to perform something similar from silverlight.
There is no workaround in pure HTML5/Javascript. You need the use of plugins, such as Java or Silverlight (maybe you shouldn't port it after all). As for workarounds, HTML5 gives you an easy way drag and drop multiple files that you could transfer on the server and then display back to your users. Another workaround would be to install a custom agent (a software with only a tray icon) that would send the information about the current user "document library" to server and then again, you could display it back to the user.
Note: I've heard somewhere that browsers will eventually stop supporting plugins. http://www.howtogeek.com/179213/why-browser-plug-ins-are-going-away-and-whats-replacing-them/
Ya, I agree with Markain. However, if you were to limit your audience solely to chrome users, I daresay, you would most likely use some of your users. If Huazhihao is right, then your number of leaving customers should decrease but users who regularly use firefox won't be happy. Overall, I think that this will not work. Otherwise, there would be too many websites that trashed your hard driver (or at least wherever you have the rights to edit/delete files). I think it would be best if your product was setup to synchronize the file whenever an internet connection was detected and a change was made to the file. That way the user would not need to visit the website whenever the file was uploaded. If this is some kind of an error file, then it would be most beneficial if you were to make a link in the application that when clicked, would upload the file to the website and the website were to do whatever was necessary. If this is a purely online thing, then I don't see what business you would have looking through other peoples' files =-). Hope I helped!

Selenium webdriver with tomcat

I have a java web application in which i have integrated some selenium code which basically does the following job :
I have a login page with user name and password,so once i fill the details and click on login button, it gives call to the selenium code(java method through servlet),which opens another tab and fills the URL and the same details there on its login page.
This works fine with one system.but i have to deploy the .war file in tomcat so that this should work for all the users in same way, but when i am accessing the URL from remote system and logging in ,its opening the browser on my server where my Apache is running.
So my question is how can i achieve this ? if any user access my URL and login it should open another tab in his system rather than on server.
I have tried using grid2, created a hub on server and node on remote system but still when i run my application it opens browser in server.
I am not sure how can i achieve this.
there is one link i found which uses java script in chrome with node.js
[http://aboutcode.net/2013/12/02/automating-chrome-on-windows-with-javascript-using-selenium-webdriverjs.html][1]
How can i execute selenium java script code in java.
Any help will be really appreciated thank you.
This sounds like a gross misuse of the Selenium TEST framework & I urge you to rethink your approach. You can achieve everything you want to with javascript from within YOUR application, passing variables via the querystring to the new window See JavaScript: location.href to open in new window/tab?
Finally able to fix the issue with grid 2
String nodeUrl = "http://"+ip+":5560/wd/hub";
DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
driver = new RemoteWebDriver(new URL(nodeUrl),capability);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
To open browser on the client end,we need to pass the IP of that client from javascript to the server.
And driver and selenium should be registered an running before executing the code.
Special Thanks to Manu..
:)

Opening locally installed windows program via PHP?

I am trying to accomplish the following:
I want a button on my website that will open a windows program on the users computer. So for example, someone clicks "Remote Desktop" on my website, and it will open mstsc.exe on the machine.
Is this possible with any language?
The way you could do this is via an URI scheme. For that to work though, your application itself needs to have an URI scheme attached to it. Examples include mailto: (opens your email client - can also be a web client such as gmail), irc: (opens Internet Relay Chat client) and an example of a truly custom URI scheme (it isn't listed in the official list) is Github's Desktop application, which uses the URI scheme github-windows:. Again, for this to work, the app itself needs to have this built into itself.
I assume you didn't make this mstsc.exe "Remote Desktop" yourself, it is impossible to start this application in any way whatsoever using just your browser. If that would indeed be possible, it would be a massive security hole. It would mean you could simply run any program (or uninstall file) you'd like.
Note: If you did indeed make the application yourself, I suggest asking another question on this site, but making it specifically about registering custom URI schemes to your application, and also specifying what language your application is written in.

How to open an .exe application which is hosted on different server using html?

How to open an .exe application which is hosted on different server using html ?
var w = new ActiveXObject("WScript.Shell");
w.Exec("C:\Program Files\Adobe\Photoshp.exe");
I tried the above code but it's working with local .exe bt nothing is working with external .exe
Assuming this is an intranet stuff, try this:
w.Exec("\\\\Your_server_name\\C:\\Program Files\\Adobe\\Photoshop.exe");
or:
w.Run("\\\\Your_server_name\\C:\\Program Files\\Adobe\\Photoshop.exe");
Your_server_name can also be an IP address. Notice also doubled backslashes, and the fact, that the path must be absolute, you can't use any drive letters mapped in local workstation. Notice also, that usually server name is not the root of the server (like C:), rather it's pointing to a folder in the server.
Both examples work great for me, no matter, if the HTA is saved in the server or workstation. Only I could imagine why they wouldn't work (additional to a wrong path), is a case, when you have not rights to the referred folder. Or... you're trying to run exe from an external WEB server, which afaik is not possible.
I dont think you can do that using JS on client side directly as this will be a security issue. The best way to do this will be first download the exe file, via http and then run it. Once you try to do this user will also be prompted for it.

how to open csv file in IE in by javascript

In my asp page, I have to open a csv file in IE by java script. The code which I am using is as below:
csvWindow = window.open("/com/csv/"+csvFileName, "datacsv", "toolbar=yes,location=no,directories=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=790,height=450,screenX=50,screenY=25,left=50,top=25");
Code is running in IIS server.
When I run this code and open csv file it gives below message
Microsoft Office Excel cannot access the file
"http://192.168.3.228:107/com/csv/CSV_file_1345728.csv". There are several possible reasons:
The file name or path does not exist
the file is being used by another program
the workbook you are trying yo save has the same name as a currently open workbook.
But file is being created.So path is correct and i think that file is also not used by another program
Please help me what should I do
The problem is that when Excel is opened it will attempt to fetch the CSV file itself, this a change in behaviour in office apps since 2007. However since Excel runs in a different process it will not send any cookies that would have been generated during the logon. When the website receives the request it will respond with a 401 status.
There are no easy solutions that I know of with entirely satisfactory results. Here are a number of solutions but all have drawbacks.
Make the authentication cookie persistent, this will allow Offices apps to pick up and send the cookie. The down side being the user remains persistently logged even after a client machine reboot (much like how Stackoverflow appears to work).
Use a standard HTTP authentication protocol like "Basic" or "Negotiate". The down side is that this will cause Excel to display a logon box and the user has to logon again. One exception to this drawback is using "Negotiate" or "NTLM" against an IIS box where the site is registered as part of the IE's Intranet Zone, in which case the HTTP stack used by excel will attempt to use the current user credentials.
Have a server side script that can run anonymously send the csv file and include in the URL some unique ID (such as GUID) which is a one off grant of access. Much more complex to set up.
If you want to open the file with MS Excel, you could try not to serve the file directly, but write an ASP page with Content-Type=application/force-download, the real file name ending with .css and the actual file content. In this case, MSIE will first download the file to the local disk cache and then will feed it to MS Excel.
If you just want to show the CSV text in the browser window, maybe the best is to change its extension or to make some proxy page with Content-Type=text/plain and no mention of CSV at all. The association CSV/Excel seems to be hardcoded in MSIE.

Categories

Resources