Web环境下使用串口
我需要在基于网络的应用程序的客户端使用串行端口。 建议在网络浏览器中使用串行端口的解决方案。 Firefox插件可以使用串口或者调用dll函数吗?还有哪些解决方案?
I need to use serial port in client side of web based application.
which solution suggested for using serial port in web browser. can Firefox addon use serial port or call dll function? which other solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须编写附加组件才能使其工作。
对于 Internet Explorer;您可以编写浏览器帮助程序对象(BHO)。
适用于 Firefox、Chrome 和 Safari;我认为你唯一的选择是使用 NPAPI 编写 Netscape 插件。 FireBreath 是构建此类插件的非常有用的框架,因为它可以为您处理很多脏活,让您可以专注于插件本身。这将使您一举解决这三个问题 - 如果您愿意,您也可以将其编写为跨平台(支持许多操作系统)。每个浏览器都有自己的扩展模型,可以用纯 JavaScript 编写;但由于缺乏需求和安全考虑,它们没有公开串行端口 API;使 NPAPI 成为唯一可行的解决方案。
然而,尽管如此,我还是会质疑您是否应该在浏览器中执行此操作。对我来说,这听起来更像是客户端应用程序。
根据您的需要,您还有一些其他选择。如果您专门针对 Windows 平台进行编写,许多人发现他们可以使用 Silverlight 4 浏览器外加上 Active-X 对象来进行串行端口访问(Silverlight 没有用于串行端口访问的本机 API)。这在浏览器中不起作用;但这是一个值得考虑的选择。
You'll have to write add ons to make this work.
For Internet Explorer; you can write a Browser Helper Object(BHO).
For Firefox, Chrome, and Safari; I think your only option is to write a Netscape Plugin using NPAPI. FireBreath is a very useful framework for building these kinds of plugins as it takes care of a lot of the dirty work for you, allowing you to focus on the plugin itself. This will let you knock out those three with one stone - you can also write it to be cross platform (support many operating systems) if you desire. Each of those browsers have their own extension models as well that can be written in pure JavaScript; but they don't expose a serial port API due to lack of need and security concerns; making NPAPI the only viable solution.
However, all that said, I would question whether or not you should be doing this in a browser at all. This sounds more like a client application, to me.
You have a few other options depending on your needs. If you are writing specifically for the Windows platform, many have found that they can use Silverlight 4 Out-of-Browser plus an Active-X object for serial port access (Silverlight does not have a native API for serial port access). This won't work in the browser; but it's an option to consider.
考虑一个实现 websocket 协议的轻量级客户端应用程序。
Consider a lightweight client application which implements the websocket protocol.