6

I could not manage to work the download attribute when downloading vcards via data URL by Chrome on IOS. I use code below

function download(filename, text) {
        var element = document.createElement('a');
        element.setAttribute('href', 'data:text/vcard;charset=utf-8,' + encodeURIComponent(text));
        element.setAttribute('download', filename);
        element.style.display = 'none';
        document.body.appendChild(element);
        element.click();
        document.body.removeChild(element);
    }

It works fine with Safari on IOS and Chrome on Android. But Chrome on IOS just ignore file name and download file just with name "document" so in not opened by contact app.

qwelp
  • 111
  • 7
  • Did you manage to solve this? Facing the same issue at the moment! – paddyfields Nov 10 '21 at 12:34
  • As of 2021-12-16, looks like setting the filename is not possible on Chrome on iOS. See https://bugs.webkit.org/show_bug.cgi?id=167341#c66. – VCD Dec 16 '21 at 07:47

0 Answers0