Web NFC API
Published
Web NFC API — The Web NFC API lets a web app read and write NDEF messages to NFC tags via the NDEFReader interface.
Browser & ecosystem support
Section titled “Browser & ecosystem support”- Legend
- Yes
- Partial
- Flag
- No
- Unknown
| Browser / Platform | Support | Versions | Confidence | Source | Notes |
|---|---|---|---|---|---|
| Chrome (Desktop) | No | — | high | source | 1 |
| Chrome (Android) | Yes | 89 | high | source | — |
| Edge (Desktop) | No | — | high | source | 23 |
| Firefox (Desktop) | No | — | high | source | 4 |
| Firefox (Android) | No | — | high | source | 56 |
| Safari (macOS) | No | — | high | source | 7 |
| Safari (iOS) | No | — | high | source | 89 |
| Samsung Internet | Yes | 15.0 | high | source | 10 |
| WebView (Android) | Yes | 89 | high | source | 11 |
- No Chrome support is recorded in browser-compat-data.
- No Edge support is recorded in browser-compat-data.
- Derived by browser-compat-data mirroring from Chrome.
- No Firefox support is recorded in browser-compat-data.
- No Firefox for Android support is recorded in browser-compat-data.
- Derived by browser-compat-data mirroring from Firefox.
- No Safari support is recorded in browser-compat-data.
- No Safari on iOS support is recorded in browser-compat-data.
- Derived by browser-compat-data mirroring from Safari.
- Derived by browser-compat-data mirroring from Chrome Android.
- Derived by browser-compat-data mirroring from Chrome Android.
How to use it
Section titled “How to use it”scan() must be called from a secure, active top-level browsing context. Once scanning
starts, reading events deliver each tag’s NDEF message:
async function scanNfcTags(onTag) { const reader = new NDEFReader(); await reader.scan(); reader.onreading = (event) => onTag(event.message, event.serialNumber);}How to detect it at runtime
Section titled “How to detect it at runtime”Check for NDEFReader before offering the feature, and give the reader a fallback path when
it is absent:
if ('NDEFReader' in window) { scanButton.hidden = false;} else { scanButton.hidden = true; fallbackNotice.textContent = 'This browser cannot scan NFC tags from the page.';}Practical checklist
Section titled “Practical checklist”- Requires a secure context — plain HTTP origins other than potentially trustworthy ones like
localhostcannot use it. scan()must run in an active top-level browsing context; calling it from a non-active context rejects the returned promise, and losing visibility later suspends rather than cancels the read.- Per MDN browser-compat-data, Web NFC has no desktop implementation in any browser —
'NDEFReader' in windowisfalseon desktop and the fallback path above is required there. - Support is limited to Chromium-based browsers on Android (Chrome for Android and browsers that mirror its engine, such as Samsung Internet); Firefox and Safari implement none of the API on any platform.
Where to go next
Section titled “Where to go next”For the full reference (permissions, write(), and the NDEF message format), see
Web NFC: reading and writing NFC tags from the web.
See also WebHID API for another device-access API.
← Back to the Compatibility explorer.