javascript - Save an image to a mobile phone gallery from a browser -


so seems unlikely purely security point of view, need cover bases. has come across method saving image in browser user's gallery? in case, i'm talking site served javascript (not phonegap).

while know can tap , hold on image save, i'd love button our less technically inclined users.

the phone ecosystem diverse, phone work me. i'm curious if it's possible.

some attempts:

works on desktop, links through on phone (android)

<a href="logo.png" download="logo.png">     <img src="logo.png" alt=""> </a> 

hangs when clicked (android)

save image user's disk using javascript

how about:

function save(){     document.addeventlistener("deviceready", ondeviceready, false); }  function ondeviceready() {     window.requestfilesystem(localfilesystem.persistent, 0, gotfs, fail); }  function gotfs(filesystem) {     filesystem.root.getfile("pic.jpg", {create: true, exclusive: false}, gotfileentry, fail); }  function gotfileentry(fileentry) {     fileentry.createwriter(gotfilewriter, fail); }  function gotfilewriter(writer) {      var photo = document.getelementbyid("image");     writer.write(photo.value);  }  function fail(error) {     console.log(error.code); } 

Comments