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

QR codes with a 'localhost' host will not be read on most Android devices #234

Open
tjsr opened this issue Mar 26, 2023 · 1 comment
Open

Comments

@tjsr
Copy link

tjsr commented Mar 26, 2023

First up, this isn't particularly a bug with react-qr-code, but definitely something which could be added to the Readme to avoid a lot of unnecessary and confusing debugging when using this component.

When generating URL QR codes based on this library, Android devices will generally (we tried four or five different methods on various phones) refuse to parse URLs with a host name of 'localhost', giving a very unspecific and cryptic error message. Using the exact same URL (even very long URLs) with 127.0.0.1 as the host fixes this, and we couldn't reproduce it with any other host.

This does not affect iOS devices - Apple phones scanned the QR code just fine. I found basically no other discussions of troubleshooting this problem online.

Perhaps you could consider making a note in the readme of this project, as it could save people a lot of headache when trying to use this component during local testing and development.

@wendellpalazzo
Copy link

I had the same problem but thanks to your comment you saved me

In a quick search on the internet, and also using some generators, it seems that there really is a restriction on the use of the url "http(s)://localhost", which when read, does not show as a link but as text just.

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

2 participants