Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

navigator.nfc undefined #161

Closed
jdiegosierra opened this issue Oct 12, 2018 · 11 comments
Closed

navigator.nfc undefined #161

jdiegosierra opened this issue Oct 12, 2018 · 11 comments

Comments

@jdiegosierra
Copy link

jdiegosierra commented Oct 12, 2018

When I test my phone in this web https://whatwebcando.today/nfc.html I'ts okey.
However when I use my own web navigator.nfc is undefined.

image

@rohmanhm
Copy link

What is your phone? And what browser do you use?

@anssiko
Copy link
Member

anssiko commented Nov 1, 2018

As with most powerful capabilities, only content served over https is allowed to access Web NFC API. If you are using a local development environment, you may be running into this issue.

For the record, this is specified in:
https://w3c.github.io/web-nfc/#extensions-to-the-navigator-interface
https://w3c.github.io/web-nfc/#the-nfc-interface

[SecureContext] is to say the API is exposed only within a secure context that is spec-speak for https.

Also noted in the security policies section, see the first bullet at:
https://w3c.github.io/web-nfc/#security-policies

Hope this helps, and good luck with your further Web NFC experiments! I'm closing this issue. Any feature requests or spec bugs, please open a new issue.

@anssiko anssiko closed this as completed Nov 1, 2018
@anujwebkul
Copy link

@anssiko
I am using chrome version 79.. but still navigator.nfc undefined and I have enabled the webnfc flag as well.

@beaufortfrancois
Copy link
Collaborator

@anujwebkul navigator.nfc is not a thing anymore in Web NFC. See https://w3c.github.io/web-nfc/#examples for many examples on how to play with Web NFC. Hopefully you'll have fun!

@anujwebkul
Copy link

@beaufortfrancois but when I am using reader.scan(); then it gives the below error.
DOMException: WebNFC feature is unavailable.

@beaufortfrancois
Copy link
Collaborator

According to https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/nfc/nfc_proxy.cc?type=cs&sq=package:chromium&g=0&l=201, it looks like NFC support is not available on your device. Which Android device do you have?

@riju
Copy link
Collaborator

riju commented Jan 17, 2020

@anujwebkul : Can you try on Chrome canary and let us know if the issue still persists ?

@anujwebkul
Copy link

It's working on chrome beta like a charm, Thanks :)

@beaufortfrancois
Copy link
Collaborator

But not Chrome canary?

@anujwebkul
Copy link

@beaufortfrancois No.

@leonhsl
Copy link
Contributor

leonhsl commented Jan 19, 2020

I tried the canary 81.0.4031.0 and reader.scan() works well there.

Is there a chance that you forgot to turn on the flag WebNFC via chrome://flags? @anujwebkul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants