I need to implement NFC (near field communication) in a PWA (progressive webapplication)
Every browser I have tested (Chrome MacOSX, Safari MacOSX, Safari iOS, Chrome for android) does not include the navigator.nfc
object in navigator and it seems impossible to make use of this API: https://w3c.github.io/web-nfc/#conformance.
Is it possible to use NFC in any way in a PWA? Or do I have to develop a native application for this functionality?
When using PWA on Android, users can experience almost all native app features, including payment, NFC, fingerprint authentication, speech recognition, and more.
In May 2021, Chrome for Android 91 came out - that and subsequent versions supports Web NFC – any web developer can experiment and use NFC from simple HTML pages (rather than an app). Apple's Safari and other browsers may provide limited support beyond Chrome (see this page for current test suite results).
The Web NFC API allows exchanging data over NFC via light-weight NFC Data Exchange Format (NDEF) messages. Note: Devices and tags have to be formatted and recorded specifically to support NDEF record format to be used with Web NFC.
Web NFC API is available only in Chrome for Android and that too when a flag is enabled(try about:flags) enabled.
Unless you are targeting your app for some internal corporate app where you can set the flag in all targeted users browser, I would recommend go with native code or wrapper(cordova or have a native app send in the details via web sockets)
This API is not making much progress since 2015 and so you can expect no magic to happen anytime soon. So don't rely on this API if you are targeting this for a critical app, especially when you cant control the end users browser settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With