Is it possible to put a data URL in a QR code?

Viewed 1110

I have a small web app which would be cool to post on a QR code as it works offline. However it appears that data URLs don't work an a QR code. Does anyone know a workaround for this? I would like to have a QR code that delivers HTML to the user's browser with no network connection.

2 Answers

QR codes just contain text. A data URL is just text. There is no problem putting one in a QR code.

Assuming the data URL is valid, the problem likely springs from the particular software you are using to decode it failing to recognise the URL scheme.

There isn't anything you can do about that beyond using other software or copy/pasting the whole thing into a web browser.

It depends on the file size. If your data url is less then 255 characters, yes. Try minifying it and using link shorteners for resources. You just need a link shortener that supports 301 redirects. Here's an example. The content is a data url for a plain-text file with the content "demo". Here's the data url. data:text/plain;charset=utf-8;base64,ZGVtbw== To test it, scan it with a phone, select the notification, copy the content, and paste it in Safari. QR Code

Related