Import .VCF file directly without downloading to storage

Viewed 1840

I am creating a HTML page with JavaScript, I want it to work at both iOS and Android, when my button is clicked, the browser should ask to open this .vcf by “contact”, or default opening by “contact” and user can save it. Especially for Android, An Android phone need to import manually the VCF by opening “contact” and select “import from” storage. That isn’t user friendly! I am wondering if the code itself can request automatically the inbuilt “contact”app.

Open vCard with Javascript this is similar question but did not solve for android

initially i have:

 function addcontact(){ vCard.export(johnDoe, "Save", true);}

//ture = force download -------------- //false = manually download

then i tried window.open method:

function addcontact(){
            var data = "BEGIN%3AVCARD%0AVERSION%3A3.0%0AN%3ADoe%3BJohn%0AFN%3AJohn%20Doe%0ATITLE%3A08002221111%0AORG%3AStackflowover%0AEMAIL%3BTYPE%3DINTERNET%3Ajohndoe%40gmail.com%0AEND%3AVCARD";
            window.open("data:text/x-vcard;urlencoded," + data);}

window is still downloading instead of looking for an app to open this .vcf document

0 Answers
Related