It's not a secret anymore!*
The moose likes HTML, CSS and JavaScript and the fly likes How to call a .exe from Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to call a .exe from Javascript" Watch "How to call a .exe from Javascript" New topic
Author

How to call a .exe from Javascript

Anubh Jain
Ranch Hand

Joined: Apr 09, 2012
Posts: 34
Ho do we call an executable file from javascript on webkit browsers?

Any help or any pointers please?

Thanks,
Anubhav
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

Not possible. What are you actually trying to accomplish?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Think of the fun hackers would have if you could do it. Guessing you are using ActiveX on IE, which will be a setting nightmare for users.

Eric
Anubh Jain
Ranch Hand

Joined: Apr 09, 2012
Posts: 34
I have a webkit browser and I have a executable file(made from cpp) to download a video on my local system. I want to invoke that file from browser so that the video can be downloaded.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

So create a link to the video file. The browser will download it and the user can play it. No need for an "exe" or anything else.
Anubh Jain
Ranch Hand

Joined: Apr 09, 2012
Posts: 34
I do have a url of video file from server.
I want to download the video file on that url so that it can be stored on my local drive.

How do i achive this?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

So you want to copy the video file from someone else's server?
Anubh Jain
Ranch Hand

Joined: Apr 09, 2012
Posts: 34
Yes I do want to copy a video from server(Not someone else's server. The server is also build by me only. That is how I got the url to download the server.)

So, is it possible using only javascript?
I dont think so. So i made a executable from cpp which could download video from any url. I just need to invoke that executable by passing the url to it.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

I don't understand why you can't just create a link to the video file.
Anubh Jain
Ranch Hand

Joined: Apr 09, 2012
Posts: 34
Because I want to play the video even when my internet is down.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10239
    
168

Anubh Jain wrote:Because I want to play the video even when my internet is down.


I don't see how that's related to creating an exe file. What's the .exe going to do if the connection to the server is down? And you do know that the .exe is useless if the client accessing your application via a browser isn't on Windows OS, don't you? As Bear has said, downloading a video file from a server and playing it on the client system doesn't require any .exe to be created. I think you should really keep aside the .exe approach and use the straightforward approach of providing a download link. If you have trouble with that part, then explain what the issue is.

[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10239
    
168

To put this in a different way - have you ever seen any website which expects you to run a .exe file to download a video file and play it?
Anubh Jain
Ranch Hand

Joined: Apr 09, 2012
Posts: 34
Yes, I haven't seen any website so far. That is why I am stuck at this point.

Besides, for your query for why to use a exe file:

Browser doesn't give me any functionality to download the video file. I can only buffer/stream the video.
But suppose I need to play the video even when my internet connection is not working or my server is down duw to some maintanence.

How will I achive this?


Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10239
    
168

Anubh Jain wrote:Yes, I haven't seen any website so far. That is why I am stuck at this point.

That's because what you are doing isn't the right way to do this.

Anubh Jain wrote:
Besides, for your query for why to use a exe file:

Browser doesn't give me any functionality to download the video file. I can only buffer/stream the video.

You haven't shown us the server side code where you are sending back the video as a response. But if you are saying that you don't see a window pop-up to save the file when you click on the link, then all you need to do is set the Content-Disposition response header as "attachment;" (google for it and you'll find more information).

Anubh Jain wrote:
But suppose I need to play the video even when my internet connection is not working or my server is down duw to some maintanence.


Once the user has downloaded the video (which of course will require server access) he won't need the access to the server anymore. So it won't matter if server is down.

Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4425
    
    8

If you want the video to work without the Internet, then the user needs to download the video. The easiest way to do this is to supply the link. An exe won't help play it remotely if the network isn't there, and an exe isn't needed to play it once it's downloaded.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

Which brings us right back to creating a link to the video file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call a .exe from Javascript