Wednesday, 17 April 2019

Create Single VCard File Contains Many Contents Using JavaScript

I use this code: githup that allows you to save a single content into VCF.

<!doctype html>
<html>
    <head>
       <script type="text/javascript" src="vcard2.js"></script>
    </head>
    <script type="text/javascript">
        // From JSON
        var johnSmith = {
            "version": "4.0",
            "n": "SMITH;John;;",
            "fn": "John Smith",
            "nickname":"js",
            "title": "Missing man too",
            "tel": [
                {"value": "555-555-555", "type": "cell"}
            ],
            "email": [
                { "value": "john.smith@work.com", "type": "work" },
                { "value": "john.smith@home.com", "type": "home" }
            ]
        }
        var link = vCard.export(johnSmith, "John Smith", false) // use parameter true to force download
        document.body.appendChild(link)
        </script>
    </body>
</html>

This Worked for single content as file see JSfiddle. My question is how to add multi contents into same VCF file.



from Create Single VCard File Contains Many Contents Using JavaScript

No comments:

Post a Comment