简体   繁体   English

如何将字符发送到USB端口?

[英]How can I send character to usb port?

Is there any way to send ASCII symbol/character to USB via webpage (HTML)? 是否可以通过网页(HTML)将ASCII符号/字符发送到USB?

We have a local PC with a webpage running in kiosk mode. 我们有一台本地计算机,其网页以信息亭模式运行。 The webpage have a button that should send that symbol/character to USB. 该网页上有一个按钮,该按钮应将该符号/字符发送到USB。 How it can be done? 怎么做?

Thanks for any help. 谢谢你的帮助。

No. 没有。

Code running in web pages is sandboxed and has no direct hardware access in general and definitely no direct USB access. 网页中运行的代码是沙盒化的,通常没有直接的硬件访问权限,并且绝对没有直接的USB访问权限。

It may actually be possible, though only by using an experimental feature that's only available in some browsers. 尽管仅通过使用仅在某些浏览器中可用的实验性功能,实际上才有可能。

More specifically, there exists a draft specification of the WebUSB API which aims to give access to USB devices from the browser, albeit with some limitations for security reasons. 更具体地说,存在WebUSB API的规范草案,该草案旨在允许从浏览器访问USB设备,尽管出于安全原因有一些限制。 For instance, Chrome requires the page to be served over HTTPS. 例如,Chrome要求该页面通过HTTPS进行投放。

This feature is currently implemented in newer versions of Chrome and, according to MDN, Opera. 目前,此功能是在较新版本的Chrome中实现的,据MDN称,Opera。

There is some more information about it on Google's blog . Google的博客上有更多有关它的信息。

Question is: 问题是:

Is there any way to send ASCII symbol/character to USB via webpage (HTML)? 是否可以通过网页(HTML)将ASCII符号/字符发送到USB?

I don't know if Electron Apps is what you call a webpage, but it is to me. 我不知道Electron Apps是否就是您所说的网页,但这对我来说就是。 If Electron App enters your usecase, you can access the NodeJS API, and therefore your machine. 如果Electron App输入了您的用例,则可以访问NodeJS API,从而可以访问您的计算机。

This could be the answer you are looking for, if the only limitation you have for your question is the use of web languages (HTML, CSS, Javascript). 如果您对问题的唯一限制是使用网络语言(HTML,CSS,Javascript),那么这可能就是您要寻找的答案。 If your limitation is give access to the world through a classic web browser, as @Quentin sayed in his answer, it is not possible. 如果您的限制是通过经典的Web浏览器访问世界,就像@Quentin在回答中所说的那样,那是不可能的。

Thanks god it's not possible. 谢谢上帝,这是不可能的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM