NFC Plugin
Read NFC tags natively in your iOS WebView app and pass tag data to your web app.
Near-Field Communication (NFC) technology is one of the latest technologies that has become very popular among mobile users. It enables two devices or a device and an NFC tag to communicate wirelessly when in close proximity. NFC is widely used on iOS devices for reading and writing small amounts of data, making it an effective tool for sharing information via NFC-enabled cards or tags.
The NFC API allows developers to read and write data to NFC tags directly from app code. This opens up new ways for apps to interact with users, from sharing contact information to embedding text snippets.
WebViewGold NFC Plugin Integration
While NFC is not part of the general WebViewGold feature scope, we offer a custom, easy WebViewGold NFC plugin integration (via JavaScript) on an individual basis.
Please send us your requirements (e.g., writing/reading text snippets and/or contact card details to/from NFC tags) via an email to [email protected] for a free consultation and a non-binding quote.
Writing
To write a value to an NFC tag, send a command from your web app by loading the following URL: writenfc://?value=data
Example:<a href="writenfc://?value=WebViewGold.com"> Write to an NFC tag </a>
This puts your app into Write Mode and stores the value until a tag is scanned.
Writing to a VCARD
Use the same API as writing plaintext. Format the text like:
VCARDSeparate properties with an underscore (
FN:John Doe
Title:Developer
TEL;TYPE=CELL:0452641211
_
_
_
_) and prefix the text with VCARD_. See https://en.wikipedia.org/wiki/VCard#Properties for a list of supported properties.
Reading
To read an NFC tag, load readnfc://. The app will return the information to your web app by calling readNFCResult(data, id, tag) where data is the stored value, id the tag identifier and tag the tag type. Define this JavaScript function in your web app to handle the values.
How to Test the API
- Open the Config file of your app’s codebase.
- Enter your purchase code.
- Set the app’s URL to the NFC API Test Page: https://webviewgoldtest.github.io/NFCtesting.html
- Run the app.
- Press one of the Read or Write options to enable the corresponding mode. If writing, enter a value.
- Bring the NFC tag to the device to complete the read or write operation. The test page and app will display the results.
SDK-style implementation notes
Treat this feature as a native capability exposed to your web layer: keep your production website or PWA as the source of truth, then use the documented WebViewGold configuration flags, URL commands, and JavaScript bridge calls to opt in to native iOS behavior only where it adds value. This approach keeps your codebase maintainable because the same web application can serve browsers, WebViewGold for iOS, and the other WebViewGold platforms with minimal conditional logic.
For reliable results, prefer HTTPS endpoints, stable route names, explicit success/error states in your UI, and small JavaScript helper functions that wrap native calls. For example, a web app built with jQuery Mobile, Lovable, Base44, Bolt, WordPress, Bubble, a custom React/Vue/Angular stack, or static HTML can expose a single button or event handler that triggers the native WebViewGold API while still showing a graceful browser fallback.
- Recommended integration pattern: detect the app context, call the WebViewGold API, then update your web UI after the native callback or route change.
- Testing checklist: validate the feature on a real device or packaged build, verify permissions and store review text, and confirm that browser-only users still receive a useful fallback.
- SEO benefit: keep feature pages, route titles, and structured content indexable on your website while WebViewGold delivers the native app shell for iOS users.