Chrome NFC Tag Basics and Features

Author

Reads 757

Detailed close-up of a metallic watch band showcasing modern and shiny design elements.
Credit: pexels.com, Detailed close-up of a metallic watch band showcasing modern and shiny design elements.

Chrome NFC tags are small, wireless devices that can store and share information with nearby devices. They're a great way to add interactivity to physical objects.

Chrome NFC tags can be read by devices with NFC capabilities, such as smartphones, tablets, and laptops. This allows users to easily access and interact with the information stored on the tag.

One of the key benefits of Chrome NFC tags is that they're extremely easy to use. Simply tap the tag with your device and you'll be taken to the associated webpage or app.

Curious to learn more? Check out: Html B Tag

Using Web API

Web NFC is only available in browsers that support it, and even then, it requires a top-level frame and a secure browsing context (HTTPS only).

To interact with the Web NFC API, feature detection is the first step, which checks if the browser supports the feature, not necessarily the required hardware.

You need to request the nfc permission while handling a user gesture, such as a button click, for the Web NFC API to work.

The Web NFC API will trigger a dialogue if access was not previously granted, and scanning or writing operations are only available when users touch a NFC Tag.

The display must be on and the device unlocked for NFC radio signals to be active.

Discover more: Websocket Api

Tag Operations

Credit: youtube.com, Chrome NFC Reader/Writer Demo

To perform various operations on NFC tags in Chrome, you'll need to instantiate a new NDEFReader object. This object allows you to write, read, and make NFC tags read-only.

You can write NFC tags by calling the write() method on the NDEFReader object, passing in a string or dictionary representing the NDEF message you want to write. The user may be prompted to grant access if it hasn't been previously allowed.

To make NFC tags read-only, call the makeReadOnly() method on the NDEFReader object. This method returns a promise that resolves if the user has granted access and the tag has been successfully made read-only.

Here are the steps to follow for each operation:

  • Write NFC
  • Call the write() method on the NDEFReader object.
  • Pass in a string or dictionary representing the NDEF message.

Make NFC tags read-only:

  • Call the makeReadOnly() method on the NDEFReader object.

Scan

To scan NFC tags, you need to instantiate a new NDEFReader object. This object will help you detect and read NFC tags.

The scan() method returns a promise that will resolve if the user has allowed the website to interact with NFC devices, their phone supports NFC, and NFC is enabled on their phone. The user may be prompted to grant access if it hasn't been done previously.

See what others are reading: Scan Nfc Tag

Credit: youtube.com, Setting Up a Scan With Tag Inspector

You should subscribe to reading events via an event listener to receive incoming NDEF messages. It's also essential to subscribe to readingerror events to be notified when incompatible NFC tags are in proximity.

A NDEFReadingEvent event is fired when an NFC tag is in proximity. This event contains two properties: serialNumber and message. The serialNumber represents the serial number of the device, while the message represents the NDEF message stored in the NFC tag.

Here are the properties of a NDEFReadingEvent event:

  • serialNumber: represents the serial number of the device (e.g. 00-11-22-33-44-55-66), or an empty string if none is available.
  • message: represents the NDEF message stored in the NFC tag.

To read the content of the NDEF message, you need to loop through message.records and process their data members appropriately based on their recordType. The data member is exposed as a DataView to handle cases where data is encoded in UTF-16.

Recommended read: Data Center Management

Write Tags

Writing to an NFC tag is a straightforward process, but it requires a user gesture, permission, and the right conditions. You need to instantiate a new NDEFReader object to write to an NFC tag.

Person Scanning QR Code on Jar of Pickles
Credit: pexels.com, Person Scanning QR Code on Jar of Pickles

To write text to an NFC tag, simply pass a string to the write() method. This method returns a promise, and the user may be prompted if access was not previously granted.

If you want to write a URL record to an NFC tag, pass a dictionary that represents an NDEF message to write(). In this dictionary, the records key should be an array of records, including a URL record defined as an object with a recordType key set to "url" and a data key set to the URL string.

You can also write multiple records to an NFC tag by passing an array of records to the write() method.

If the NFC tag already contains an NDEF message that you don't want to overwrite, set the overwrite property to false in the options passed to the write() method. In this case, the returned promise will reject if an NDEF message is already stored in the NFC tag.

To write an external type record, pass an NDEF message dictionary to the NDEFReader write() method. The external type record contained in the NDEF message is defined as an object with a recordType key set to the name of the external type and a data key set to an object that represents an NDEF message contained in the external type record.

A clean and modern minimalist design of a white round electronic device with a blue light ring on a reflective glass surface.
Credit: pexels.com, A clean and modern minimalist design of a white round electronic device with a blue light ring on a reflective glass surface.

Here's a summary of the conditions that need to be met to write to an NFC tag:

  • It was only called in response to a user gesture such as a touch gesture or mouse click.
  • The user has allowed the website to interact with NFC devices.
  • The user's phone supports NFC.
  • The user has enabled NFC on their phone.

Remember, you need to meet these conditions to successfully write to an NFC tag.

Make Tags Read-Only

To make tags read-only, you can use the `makeReadOnly()` method of the `NDEFReader` object. This method returns a promise that resolves if the following conditions are met: the user has allowed the website to interact with NFC devices, the user's phone supports NFC, the user has enabled NFC on their phone, and the user has tapped an NFC tag and the NFC tag has been successfully made read-only.

You can make an NFC tag permanently read-only after writing to it by calling `makeReadOnly()`. To do this, first instantiate a new `NDEFReader` object and then call `makeReadOnly()`. The user may be prompted if access was not previously granted.

Here are the conditions that need to be met for `makeReadOnly()` to resolve successfully:

  • It was only called in response to a user gesture such as a touch gesture or mouse click.
  • The user has allowed the website to interact with NFC devices.
  • The user's phone supports NFC.
  • The user has enabled NFC on their phone.
  • The user has tapped an NFC tag and the NFC tag has been successfully made read-only.

Note that `makeReadOnly()` is a one-way process and cannot be reversed. Once an NFC tag has been made read-only, it can't be written to anymore. This is a security feature to prevent malicious users from overwriting an NFC tag's content.

Browser Support

Credit: youtube.com, How to Find NFC Devices on Google Chrome

Browser support for Chrome NFC tags is a great feature, and it's available on Android in Chrome 89. This means you can start experimenting with NFC tags right now.

To get the most out of this feature, you can show your support by sending a tweet to @ChromiumDev using the hashtag #WebNFC. This will help the Chrome team prioritize future features and show other browser vendors the importance of supporting Web NFC.

Here are the specific versions of Chrome that support Web NFC:

  • Chrome 81 has an origin trial for Web NFC on Android.
  • Chrome 89 has Web NFC available on Android.
  • The origin trial for Chrome 81 is expected to end in Chrome 84.

By supporting Web NFC, you'll be helping to bring this feature to more users and enabling developers to create new and innovative experiences.

New Features

One of the most exciting features of the Chrome NFC Tag is its ability to read and write NFC tags with just a few clicks. This is made possible by the browser's integration with the device's NFC hardware.

The Chrome NFC Tag also supports multiple tag formats, including NDEF, MIFARE, and FeliCa. This means you can use it with a wide range of devices and applications.

For another approach, see: What Is G E O S M I N

Credit: youtube.com, This is why you NEED NFC Tags! (NFC Tasks Automation)

With the Chrome NFC Tag, you can create and customize your own NFC tags using a simple and intuitive interface. This is perfect for personalizing your devices and creating custom tags for specific tasks.

The Chrome NFC Tag is also compatible with a variety of devices, including Android smartphones and tablets.

Web Background

Reading an NFC tag from a mobile phone is typically done in two ways: waving the phone over an encoded tag to launch a website, or using an App to scan or encode the tag.

The first method, without an App, only allows the tag to be read, not encoded. An App is always required to encode tags or access a NFC tag's UID, a 7-byte unique ID locked onto the tag during manufacture.

Web NFC changes this by allowing NFC tags to be scanned and written directly from a browser, eliminating the need for additional Apps.

Currently, Web NFC is only available on Android phones, specifically in the latest version of Chrome for Android (81), which is still under development registration.

Widespread use of the tech is unlikely to happen soon, as it requires Apple iPhone support, which is not currently available.

Assessing Usefulness

Credit: youtube.com, How you can use NFC to improve your everyday life!

Web NFC is a game-changer for user experience, allowing users to interact with NFC tags with just a few lines of code.

The ability to add NFC tag interaction to existing websites is a huge plus, eliminating the need for complex app development, testing, and setup.

Museums and art galleries can use Web NFC to display additional information about an exhibit when a user touches their device to an NFC card near the exhibit.

Inventory management sites can read or write data to the NFC tag on a container to update information on its contents.

Here are some examples of sites that may use Web NFC:

  • Museums and art galleries
  • Inventory management sites
  • Conference sites
  • Sites for device or service provisioning

The technology also allows access to the tag UID, which can be used as an additional level of authentication and identification, making it a secure and convenient way to authenticate products or items.

Usefulness

Web NFC offers a range of useful features for developers and users alike.

One key benefit is the ease of development, allowing existing websites to add NFC tag interaction with just a few lines of code.

Close-Up Shot of Keychain on Person's Hand
Credit: pexels.com, Close-Up Shot of Keychain on Person's Hand

This simplicity is a major advantage, as it eliminates the need for complex app development, testing, and setup.

In fact, some websites can even complete this process without any additional downloads.

The technology also provides access to the tag UID, which can be used as an additional level of authentication and identification.

This is especially useful in combination with the NTAG424 authentication chip, which enables users to access a website, scan an NFC tag, and get authentication of a product or item without any extra hassle.

Some examples of sites that may use Web NFC include museums and art galleries, inventory management sites, conference sites, and more.

These sites can use Web NFC to display additional information about exhibits, update inventory data, scan NFC badges, and even share initial secrets for device or service provisioning scenarios.

A fresh viewpoint: Ftp Access through Chrome

Current Status

Let's take a look at the current status of our project. We've completed all the necessary steps, and everything is ready to move forward.

Detailed view of a circular metallic device with bullet-like elements, on a soft background.
Credit: pexels.com, Detailed view of a circular metallic device with bullet-like elements, on a soft background.

The first step was to create an explainer, which is now complete. We've also finished creating the initial draft of the specification.

Here's a summary of the completed steps:

We've also gathered feedback and iterated on the design, which is now complete. This means we can move forward with confidence, knowing that we've covered all the necessary bases.

Check for Permission

Checking for permission is a crucial step in assessing the usefulness of certain features, like NFC scanning. The Permissions API allows you to do just that.

You can use the Permissions API to check if the "nfc" permission was granted, which is necessary for scanning NFC tags without user interaction. This is especially useful if access was previously granted.

The same mechanism works for writing NFC tags, as it uses the same permission under the hood.

Frequently Asked Questions

What is NFC in Chrome?

The Web NFC API in Chrome allows websites to interact with nearby NFC devices, enabling features like reading NFC tags and writing messages. This technology enables a new level of interactive and immersive experiences on the web.

Nancy Rath

Copy Editor

Nancy Rath is a meticulous and detail-oriented Copy Editor with a passion for refining written content. With a keen eye for grammar, syntax, and style, she has honed her skills in ensuring that articles are polished and engaging. Her expertise spans a range of categories, including digital presentation design, where she has a particular interest in the intersection of visual and written communication.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.