Question

I have a non-computing device that needs to send a user of that device to a certain web page based on the current state of the device. The state consists of multiple key-value pairs that we encode into a URL (e.g. http://example.com/doMyStatus?prop1=val1&prop2=val2). All told, this URL may reach 500+ characters so we cannot expect the user to type it into her browser manually.

Instead, we plan on displaying a QR code with the URL that a user can visit with a smartphone. Due to this, we cannot submit this long URL as a POST request to the server (although that would be the best approach). Is there any way to compress a URL to fit within a medium-resolution QR code? We only need to compress the query string: the QR code will contain a URL like http://example.com/decompress?compressedQueryString.

Zip+Base64 just makes the URL longer. I've considered writing a custom URL shortener and having the device submit the URL for shortening before creating the QR code which is a lot more work (storing (short lived!) shortened URLs) but probably the most practical solution.

Était-ce utile?

La solution

I'd use a URL shortner like http://yourls.org/ - it's self hosted, zero maintainence, and has a number of plugins to autogenerate the QR codes.

Autres conseils

I recently created a scheme which achieves ~50% compression. QR codes allow direct binary data so you don't need to have a final base64 encoding step.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top