Lucas_Santos
Lucas_Santos

Reputation: 4740

Download .EXE file via JQuery

How can I do a function, that allow do the download of a file in C: ?

For example, when the link is clicked, trigger a javascript function that will open the file or made download.

I'm trying this,

But it execute the program, I need that execute a download!

   if (url == "Supremo") {
       var oShell = new ActiveXObject("WScript.Shell");
       var prog = "C:\\inetpub\\wwwroot\\admin.redenetimoveis.com\\San\\up\\arquivos\\Supremo.exe";               
       oShell.run('"' + prog + '"', 1);
       return false;
   }

Upvotes: 1

Views: 5396

Answers (2)

Kevin B
Kevin B

Reputation: 95022

Create a hidden iframe with a src attribute pointing to the file that needs to be downloaded. Keep in mind, however, that the src value needs to be a file that is accessible to the client, such as going to a domain. http://www.somedomain.com/thefile.exe

Upvotes: 0

saluce
saluce

Reputation: 13350

To get a user to download an exe file, you simply need to point them to the url with something like

window.location = 'http://admin.redenetimoveis.com/Supremo.exe';

As per the comment below, simply make an anchor tag that points to the file:

<a href="http://admin.redenetimoveis.com/Supremo.exe">Download Executable</a>

Upvotes: 4

Related Questions