Download base64 pictures in the mobile browser is the .bin file

I want to click the button to save a QR code picture in which src is base64 to the phone. I find that it can be saved normally by clicking on the PC, but when I click on the phone, I find that it saves a .bin file

.

clipboard.png

is there any solution to this problem, bosses?

the following is the code

  qrcodeBut() {
    // base64
    this.domArr = []
    var dom = document.getElementById("qrcodeBut")
    this.domArr.push(dom)
    console.log(this.domArr)
    this.domArr.push(this.domArr[0].children[0].children)
    console.log(this.domArr)
    var src = this.domArr[1][0].src
    console.log(src)

    let aLink = document.createElement("a");

    let blob = this.base64ToBlob(src); //new Blob([content]);
    aLink.download = "fileName";
    aLink.href = URL.createObjectURL(blob);
    aLink.click()

  }
Sep.30,2021

isn't the picture saved by pressing the long button on the mobile phone.


solve the problem


you can use canvas to convert it to png
canvas.toDataURL ("image/png")

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ce96-2c367.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ce96-2c367.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?