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 code image only gets downloaded successfully on IOS or flagship devices. #277

Open
muhammadnaeemtahir opened this issue Sep 15, 2022 · 1 comment

Comments

@muhammadnaeemtahir
Copy link

I have recently finished this project using qrcodejs Free QR code generator.

Everything else is fine, but on devices i.e. Android, it throws an error Download fail or an undefined.html file gets downloaded.

@muhammadnaeemtahir muhammadnaeemtahir changed the title QR code image gets download successfully on IOS or flagship devices. QR code image only gets downloaded successfully on IOS or flagship devices. Sep 15, 2022
@emmymayo
Copy link

Depending on your context you can try this

const downloadQR = () => {
let link = document.createElement('a');
link.download = 'qrcode.png';
link.href = document.querySelector('#qrcode canvas').toDataURL()
link.click();
}

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