How open a local file with the associated program from a web page?

前端 未结 6 1614
萌比男神i
萌比男神i 2021-01-23 23:25

I know the user of my app has a local file named c:\\sourcefile.cs, I need to find a way to render a link to that file so that when he clicks the link, it will open the file in

6条回答
  •  爱一瞬间的悲伤
    2021-01-23 23:53

    You will have to use some sort of binary code (meaning, non-JavaScript) which will more than likely require explicit permission on the user's part to access the browser's hard drive.

    For FireFox, the way to do this is through a Plugin which will give the browser the capability (or at least your plugin the capability through the browser) to do what you want, while getting the explicit security permissions.

    You should start with the API for FireFox plugins and go from there. This is a FireFox-specific solution.

    If you want something that is browser-agnostic at some point, you might want to look into embedding a Java applet into the page. Of course, this will require permissions from the user for the applet to access the hard drive, but it will work in any browser that has the Java plugin installed.

提交回复
热议问题