davidshimjs / qrcodejs

Cross-browser QRCode generator for javascript
MIT License
13.63k stars 4.76k forks source link

QR Code will not resize on Google Pixel 5/6 #290

Open Spederan opened 1 year ago

Spederan commented 1 year ago

Ive tested it across multiple devices, and it will not set itself to the correct size when resized on a Google pixel 5 or 6, but works fine on everything else. This makes my QR codes too large.

almatrass commented 1 year ago

I'm assuming you're generating a bigger QR code, then sizing it using CSS.

On some devices the QR code is generated as a <canvas> element, not as an image.

This means you'll need to apply the CSS to both the image and canvas to ensure it works on all devices:

#qrcode img, #qrcode canvas {
    width: 250px;
    height: 250px;
}
carl2049 commented 1 year ago

Give #qrcode div a certain width, then:

#qrcode img, #qrcode canvas {
width: 100%; height: auto;
}