problem description
has made a webapp that runs mainly on the mobile phone, and now there are two places where you need to download the image to the local. One place needs to generate the QR code at the front end and merge it, so the canvas is converted to the image code of base64, and the other is the image link uploaded to Aliyun.
itself, WebView or browsers have the ability to save long-press images, but now when these two pages are embedded in app, Android can no longer long press to save pictures.
so I studied whether the H5 terminal could download pictures locally. The research was very hard, and the result was very uncomfortable. So far, I haven"t found a really feasible way.
the environmental background of the problems and what methods you have tried
try method 1:
<a href="xxxx" download></a>
the PC side directly jumps out of the page to open the picture, while the mobile end directly has no response
try method 2:
<iframe src="imgUrl" name="frame"></iframe>
function downloadImage() {
window.frames["frame"].document.execcommand("SaveAs")
}
directly save across domains, and I don"t know whether the actual effect is OK!
Hope
if you can, I hope God will show me the way; if not, please say clearly, let me die this heart!