Html 是否可以在 HTML5 应用程序中访问 NFC API?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22860874/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:28:39  来源:igfitidea点击:

Is it possible to access NFC API in HTML5 applications?

htmlauthenticationnfcuniqueidentifiersmartcard-reader

提问by Suresh Savage

I have a requirement to include NFC Card reader to read associate ID to authenticate the user for a web app displayed in a touch screen.

我需要包含 NFC 读卡器以读取关联 ID,以验证触摸屏中显示的 Web 应用程序的用户身份。

Is it possible to use SCM NFC reader module for a web-based app.

是否可以将 SCM NFC 读取器模块用于基于 Web 的应用程序。

Is there any plugin that can we included in the client or server side for this purpose ?

为此,我们可以在客户端或服务器端包含任何插件吗?

Thanks in advance.

提前致谢。

回答by Michael Roland

The Web NFC API(maintained by the NFC Working Groupis currently in draft status. This API is intended to provide access to NFC functionality for HTML5.

网站NFC API(由维持NFC工作组目前处于草案状态,这个API是为了提供对NFC功能的HTML5。

BUT

  1. In its current version the NFC Web API does not provide any means to get a tags ID/serial numer/anti-collision identifier (I assume that's what you mean with ID, right?). In fact the API will only provide access to NFC tags through the NDEF abstraction layer.
  2. I don't know of any browser release that currently implements the NFC Web API.
  1. 在其当前版本中,NFC Web API 不提供任何获取标签 ID/序列号/防冲突标识符的方法(我认为这就是您对 ID 的意思,对吧?)。事实上,API 将仅通过 NDEF 抽象层提供对 NFC 标签的访问。
  2. 我不知道当前实现 NFC Web API 的任何浏览器版本。

UPDATE

更新

The NFC Working Group was closed after its charter expired (mainly due to lack of support by browser vendors) and is no longer maintaining the specification. Instead there is a Web NFC Community Groupnow that maintains the Web NFC API specificationnow.

NFC 工作组在其章程到期后关闭(主要是由于缺乏浏览器供应商的支持)并且不再维护该规范。相反,现在有一个Web NFC 社区组来维护Web NFC API 规范

回答by user2399706

As an update to the above. The latest Chrome Canary for Android does now support WebNFC. Interestingly, the primary Chrome supports the older protocol of the NFC.watch method which allows for data to be read/written but the new one has changed to NFCReader methods which are promise based which you start and stop. The later allows for reading of the ID. https://w3c.github.io/web-nfc/

作为对上述内容的更新。最新的 Android 版 Chrome Canary 现在支持 WebNFC。有趣的是,主要的 Chrome 支持 NFC.watch 方法的旧协议,该协议允许读取/写入数据,但新协议已更改为基于承诺的 NFCReader 方法,您可以启动和停止。后者允许读取 ID。 https://w3c.github.io/web-nfc/

回答by ehsan mohajeri

There is an API out there, but there is no browser release supportingthis API due to the lack of its development!

有一个 API,但由于缺乏开发,没有浏览器版本支持这个 API!