是否完全可以从Web应用程序访问用于跨浏览器跨OS的USB? [英] Is accessing USB from a web application for cross browser cross OS possible at all?

查看:137
本文介绍了是否完全可以从Web应用程序访问用于跨浏览器跨OS的USB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以实现这一目标.我听到了有关Silverlight 4,JavaScript或ActiveX控件的不同说法,但是我还没有看到其中任何代码的演示.

I am wondering if there is a way we can achieve this. I heard different things about Silverlight 4, JavaScript or ActiveX control, but I have not seen any demo of code for any of them.

是否有一个可用的Web组件,或者我该如何编写一个Web组件?

Is there a web component that is available or how can I write one?

我们真的很想通过Web捕获客户端的USB驱动器并在其中读取/写入数据.这必须适用于 any 网络浏览器中的 any 操作系统.

We really like to capture a client's USB drive via the Web and read/write data on it. This has to work for any operating system in any web browser.

在浏览器模式下WPF呢?我读到可以将WPF应用程序托管在浏览器中,并且有点像智能客户端.

What about WPF in browser mode? I read that I can host my WPF applications inside browser and sort of like smart client.

这是通过Silverlight 4进行此操作的一个很好的例子,但是作者提到了可以通过以下方式在Mac上访问USB的可能性:

Here is a great example of doing this via Silverlight 4, but the author mentions about possibility of accessing USB on Mac via:

  1. 启用 AppleScript 脚本. 此选项将使我们在Mac机器上具有与Windows机器相同的控制量.

  1. Enable executing AppleScript scripts. This option will let us have the same amount of control on a Mac machine as we do on a Windows machine.

向ComAutomationFactory.CreateObject()添加重载,该重载在场景下调用告诉应用程序"命令并获取AppleScript对象. 对于 Microsoft Office 自动化,此选项将非常有效.对于其他任何操作系统功能,您都必须对操作系统访问进行两次编码.

Add an overload to ComAutomationFactory.CreateObject() that calls the "Tell Application" command under the scenes and gets a AppleScript object. This option would work extremely well for Microsoft Office automation. For any other operating system feature, you’ll have to code the OS access twice.

我不太了解.有尝试过吗?

I did not quite understand it. Has any tried this?

推荐答案

如果愿意引入对Flash的依赖关系(10),则可以使用FileReference类一次访问一个文件,对于使用浏览方法,然后使用保存方法.

If you're willing to introduce a dependency on Flash (10), you can use the FileReference class to get access to one file at a time, first for reading using the browse method, then for writing using the save method.

请注意,出于安全考虑,必须通过用户输入(例如单击按钮)来触发对这些方法的每次调用,并且每次调用它们时都会显示OS特定的文件打开/另存为"对话框.

Note that for security reasons, each call to these methods must be triggered as a result of user input (e.g. clicking a button), and each time they are called an OS-specific File Open/Save As dialog box is displayed.

有一个视频教程,其中提供了一些用于编辑文本文件的示例代码(加载+保存)直接在Flash中进行,而无需任何服务器端帮助.它应该足以使您朝正确的方向开始.

There's a video tutorial which gives some sample code for editing a text file (load + save) directly in Flash, without needing any server-side help. It should be enough to get you started in the right direction.

这篇关于是否完全可以从Web应用程序访问用于跨浏览器跨OS的USB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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