tree: 63f7ab93119e78a85ae457d8be3c8434c2f9a224 [path history] [tgz]
  1. android/


High level Overview

The implementation of Web NFC in Chromium consists of two main parts:

  • The NFC module in Blink located at third_party/blink/renderer/modules/nfc/ which contains Blink JavaScript bindings for Web NFC.
  • The browser side platform level adaptation located at services/device/nfc.

The Blink NFC module communicates with the browser adaptation through NFC Mojo interface defined in the services/device/public/mojom/nfc.mojom file and implemented by the services/device/nfc module.

NDEFReader is the primary interface of Web NFC. The NDEFReader interface has both, write and scan methods:

  • The write method is for writing data to an NFC tag. This method returns a promise, which will be resolved when the message is successfully written to an NFC tag, or rejected either when errors happened or process is aborted by setting the AbortSignal in the NDEFWriteOptions.
  • The scan method tries to read data from any NFC tag that comes within proximity. Once there is some data found, an NDEFReadingEvent carrying the data is dispatched to the NDEFReader.

The most important classes for Android adaptation are NfcImpl, NfcTagHandler, and NdefMessageUtils.

Web-exposed Interfaces

Web NFC specification


Security and Privacy

Web NFC API can be only accessed by top-level secure browsing contexts that are visible. User permission is required to access NFC functionality. Web NFC specification addresses security and privacy topics in “Security and Privacy” chapter.


The device service provides no support for permission checks. When the renderer process requests access to NFC, this request is proxied through the browser process by NfcPermissionContext which is responsible for checking the permissions granted to the requesting origin.

Platform Support

At the time of writing, only Android platform is supported.

Design Documents

Please refer to the design documentation for more details.