is open outside the browser For an Intranet web applicatio...">

Make sure <a href= "https://stackoverflow.com/local file" rel="nofollow noreferrer"> is open outside the browser

For an Intranet web application (document management) I want to show a list of files associated with a specific client. The resulting HTML looks like this:

<a href="file:///server/share/dir/somefile.docx">somefile.docx</a>
<a href="file:///server/share/dir/someotherfile.pdf">somefile.pdf</a>
<a href="file:///server/share/dir/yetanotherfile.txt">yetanotherfile.txt</a>

      

This works great. Unfortunately, when clicking on a text file (or image file), Internet Explorer (and most other browsers, I believe) insists on showing it in the browser rather than opening the file with the appropriate application (like Notepad). In our case, this is undesirable behavior, as it prevents the user from editing the file.

Is there a way to workaround this behavior (like something like this <a href="file:///..." open="external">

)? I know this is a browser specific thing and an IE only solution will be ok (it's an Intranet app after all).

+2


a source to share


2 answers


Do you want people to simply communicate with things on your server? It smells like insecurity to me ...



I would recommend that the user check it out locally and use a database or similar so that people can check out new drafts. The referenced projects must be checked and verified in some way before they are actually written to the server file system.

+1


a source


I just tested this and it seems to work (IE6, not in FF or Chrome):

<HTML>
<script language="JavaScript">
  function startWord(strFile)
  {
    var myApp = new ActiveXObject("Word.Application");
    if (myApp != null)
    {
      myApp.Visible = true;
      myApp.Documents.Open(strFile);
    }
  }
</script>
<a href="javascript:startWord('file:///server/share/dir/test.doc')">test.doc</a>.

      



Found it here .

0


a source







All Articles