NFC

NFC stands for Near Field Communications, a short-range wireless technology operating at 13.56 MHz that enables the communication between devices at a distance less than 10 cm and a transmission rate of up to 424 kbit/s.

The Web NFC API allows exchanging data over NFC via light-weight NFC Data Exchange Format (NDEF) messages. Devices and tags must be formatted and recorded specifically to support NDEF record format to be used with Web NFC. Low-level operations are currently not supported by the API, however, there is a public discussion about an API that would add such functionality.


const reader = new NDEFReader();
reader.scan().then(() => {
   console.log("Scan started successfully.");
   reader.onerror = () => {
      console.log("Cannot read data from the NFC tag. ");
   };
   reader.onreading = event => {
      console.log("NDEF message read.");
   };
}).catch(error => {
  console.log(`Error! Scan failed to start: ${error}.`);
});

As of Dec 22, 2021, the Web NFC API is an experimental technology not supported by any browser.