如何使用网页中的相关程序打开本地文件? [英] How open a local file with the associated program from a web page?

查看:210
本文介绍了如何使用网页中的相关程序打开本地文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我的应用程序的用户有一个名为c:\sourcefile.cs的本地文件,我需要找到一种方法来呈现该文件的链接,以便当他点击该链接时,它将打开该文件Visual Studio。

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 Visual Studio.

这是供我们开发团队内部使用的,所以如果没有标准的方法,我不介意使用非传统方法。

This is for internal use in our dev team so I don't mind using unconventional means to do that if there is no standard way to do it.

解决方案必须与Firefox一起使用。

The solution has to work with Firefox.

推荐答案

你将拥有使用某种二进制代码(意思是非JavaScript),很可能需要用户的明确许可来访问浏览器的硬盘。

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.

对于FireFox ,这样做的方法是通过插件,这将为浏览器提供功能(或至少你的插件通过浏览器的功能)做你想要的,同时获得明确的安全权限。

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.

你手ld从 FireFox插件的API 开始,然后从那里开始。这是一个特定于FireFox的解决方案。

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

如果您想要某些与浏览器无关的内容,您可能需要考虑将Java小程序嵌入到页面中。当然,这需要用户对applet访问硬盘驱动器的权限,但它可以在安装了Java插件的任何浏览器中使用。

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.

这篇关于如何使用网页中的相关程序打开本地文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆