1

Is there a way to provide a hyperlink to a file on a file server but rather than downloading it, have it open in an application? For example a .doc file on the server, but rather than downloading the file it would then open in word so the user could edit the file directly instead of downloading a copy?

I have tried using file:///// but that seems to just download the file.

Herrozerro
  • 1,601
  • 1
  • 22
  • 37
  • It depends on a few factors that are completely outside of your control. If the MIME type is set correctly on the server and the client has an application associated with that MIME with the default functionality of the application and/or browser set to open in that application, then it will work the way you are wanting.. – Howard Renollet Jul 08 '15 at 17:47
  • #1, each user's browser must be configured to allow launching of external programs from the browsers. A lot of browsers have this feature disabled by default (especially within companies) because it's not guaranteed that the program being opened is not malicious. #2 if it is allowed, JavaScript is the key. – Michael Plautz Jul 08 '15 at 17:50

3 Answers3

1

There are a number of misconceptions in your question:

  • It is up to the browser how a particular type of file is handled
  • The user does not get to do anything directly on the server; if anything, the server would provide a copy of the file, and would accept a modified version for replacement. This would require co-ordination between the two.
  • file:// is used to identify a file on the local computer
Scott Hunter
  • 48,888
  • 12
  • 60
  • 101
1

You can force a response to download with the Content-Disposition header, but that requires serverside doings, and you still can't force an open - that is up to the end-user and their browser, and you can't change that.

If you're developing both sides of the application (the webserver side and a client-side application), you can use application specific URIs, and register those with the operating system on the client side. This is what applications like Spotify do - they link to a URI like spotify://song.info.here, and if Spotify is installed, the browser hands off to the application.

Community
  • 1
  • 1
cincodenada
  • 2,877
  • 25
  • 35
0

No. You can`t do that. The user always will be prompted to either save or open the file

Petko Kostov
  • 367
  • 1
  • 9