samples: NDEFReader not found in window

Hi, I seem to have some issue detecting the NFC feature support using the code snippet: if ('NDEFReader' in window) { /* Scan NFC tags */ } if ('NDEFWriter' in window) { /* Write NFC tags */ }

However, when I visit https://googlechrome.github.io/samples/web-nfc/ on the same browser it seems to work.

Any idea what may be the issue here?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 26 (11 by maintainers)

Most upvoted comments

I’ve figured the issue, seems that you need to enable Experimental Web Platform features flag on the Chrome Beta browser as well. Found out from this commit: https://github.com/GoogleChrome/samples/commit/bb1c58ef8ede07e56c8ef075d0b477a917764782

FWIW, the content attribute which should contains the token is empty at https://webnfc.now.sh/

image

Using Chrome Beta v81.0.4044.42, Web NFC is available for me at https://googlechrome.github.io/samples/web-nfc/ Note that it not used on this website, you need either to enable the flag OR request a token for origin trial

See screenshot below

image