Skip to main content
The rejection webNfcTapSource throws when a scan fails in a way worth surfacing. Every failure is typed so the interface can react by reason - re-prompt, point at a settings screen, or fall back to opening the tap link - rather than reading message. A readable tag that is not an Endstate chip is not an error: the source resolves null for that.

Example

Properties

string
required
Always "WebNfcError".
WebNfcFailureReason
required
What failed. Branch on this, never on message.
string
required
A human-readable description of the failure. Diagnostic only; do not branch on it.
unknown
The underlying browser error, when one triggered the failure. Present for the DOM-error reasons; absent for empty-tag, which the source raises itself.

Reasons

Each reason maps to a distinct thing to present. The last four all mean the same fallback - open the tap link - but stay separate so you can explain why.
permission-denied and permission-not-requested are distinguished by re-querying the origin’s permission after the browser reports a NotAllowedError: a still-askable "prompt" state becomes permission-not-requested, otherwise permission-denied. Use webNfcPermissionState to gate the interface before a scan so you can avoid the denied path altogether.

See also