javascript - How to deal with errors when doing canvas.toDataUrl() on safari and ios?
伊谢尔伦
伊谢尔伦 2017-05-31 10:41:03
0
1
1290

First I installed two pictures in a p: the picture in base64 format and the local picture obtained by input type=file

Then use html2canvas to synthesize a canvas

Finally, in order to facilitate the long press to save the image on the phone, I want to convert the canvas synthesized by html2canvas into base64 using toDataUrl and then display it with the img tag.

But! Here comes the problem. I reported this error in Safari, and it cannot be converted to base64 on the phone.
All my pictures are in base64 format, and they are not cross-domain. There is no problem in Chrome . Does anyone know what happened? Please give me the ending

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all (1)
世界只因有你

canvas = document.querySelector("#canvas")??
The following is a synthesis function page I wrote recently. It can run well on all devices. I hope it can help you.
http://lonelymoon.linux2.jiuh...
Or you can give a project link. You need to see the actual effect and code before you can give a solution. Otherwise, you can only rely on guessing. Try typing document in the console. CreateElement("canvas").toDataURL() See if it can run. If it can run, it means there is no problem with the interface and it is a problem within the code.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!