imageshare
imageshare copied to clipboard
Fallback for PNG QR codes
The QR code is currently rendered as a PNG image with no alpha transparency layer, which works well across modern and legacy devices. However, some older browsers support file uploads (the base requirement for ImageShare) but not embedded PNG images, so the QR code doesn't load. Netscape 3.x for Mac is one example I tried.
Internet Explorer didn't support PNG until v4.0 in 1997 on Windows, and v5.0 in 2000 on Mac. Netscape didn't support it until v4.04 in 1997, but I'm not sure if earlier versions support file uploads anyway. This page has more information about PNG support across old web browsers: http://www.libpng.org/pub/png/pngapbr.html
Ideally, ImageShare should provide QR codes in a different format for browsers that don't support PNG. I'm not sure which format would work best (some of them support inline JPEG?). The QR code generation library can only export to PNG or SVG, so another library would need to be used to convert images. I'm also not sure if any kind of feature detection is possible, or if ImageShare would need a list of user agent strings to check and downgrade to another format.
Netscape 3.0 did support file uploads, but I can't vouch for Netscape 2.0 and earlier, owing to having had little experience with these. In its time, Netscape was one of the most fully-featured browsers. The only good competitors feature-wise were Opera, Konqueror, iCab, and Internet Explorer since 4.0.
It's possible to configure non-PNG-supporting browsers through MIME types to open PNG files in an external app that would support that format.
Yeah, downloading the QR code image is an option. I haven't checked if these old browsers send the Accept HTTP header with a list of supported formats, that would probably be the best detection method.
This is implemented now on the main branch and the production server, it will be included in the next official release. The JPEG QR code images tend to be several times larger than the PNG images (one test was 5KB vs 19 KB), so ImageShare uses a combination of the Accept header and User Agent header to check the browser's image support. If the client definitely supports PNG, it gets the original PNG image, otherwise it gets the JPEG.
This check isn't perfect, as a lot of browsers don't seem to include supported image formats in the Accept header, and adding more user agent overrides could create more false positives. It's not the end of the world if a JPEG gets loaded instead, though.
This is now included in the v3.1 release!