withTag, openSession, tags and their guards, the error codes, the React hooks —
is the same code running.
What you actually get
NDEF only. A browser is handed records the platform has already interpreted; it never gets the radio. So:getNdefStatus rejecting is deliberate. Web NFC reports neither whether a tag is writable nor how
much room it has, and returning invented numbers would only move the failure to the write, where
it would surface as something else entirely.NDEFReader.write writes to whichever tag is
next in the field rather than to the one your handle refers to. In practice that is
the tag still being held against the phone, and this is documented rather than
hidden because the difference matters if you ever hold two tags near a device.
HTTPS and a user gesture are required. Web NFC refuses to scan from a page that
is not secure, and the first call has to come from a click or a tap. A declined
permission surfaces as notAuthorized, which is the same code the native platforms
use for the same situation.
Reading a tag’s identifier
Chrome reports the serial number with colons —04:a2:b3:c4. This library
normalises it to plain lowercase hex, so tag.idHex reads the same on every
platform. The specification does not require a serial number at all, so tag.id
can be null on the web where it is populated on a phone.
What is not translated
The bytes on the tag are never visible to a browser: Web NFC hands over records it has already interpreted, so the shim rebuilds NDEF records from them and rebuilds Web NFC’s shape again in order to write. That mapping is faithful for text, URLs, absolute URIs, MIME, external and unknown records, and it is round-trip tested in both directions because a browser gives no way to check the result against real bytes. Two things it refuses rather than guessing:Writing a smart poster
Writing a smart poster
Web NFC’s write API builds records itself and cannot express a nested message. Write the URL and
the title as separate records, or write that tag from a phone.
A record type Web NFC reports that this library does not recognise
A record type Web NFC reports that this library does not recognise
Reading it as opaque bytes would be a guess about what it means.