Adding a vCard download to landing page

I am attaching a screenshot of where I want to put the script below. If I open this in a browser, it works perfectly. The javascript is currently in an anchor tag with a custom link. All this does is create a vCard and download it. I want to download the vCard onclick of the “Download Contact” button.

Here is the code I want to put in the Landing Page:

<html>

<head>

</head>

<body onload=“loadvcard()”>

<script>

function loadvcard(){

var data = “BEGIN%3AVCARD%0AVERSION%3A3.0%0AN%3ABriggs%3BMatthew%0AFN%3AMatthew%20Briggs%0ATITLE%3AContent%20Manager%0AORG%3ASt.%20Charles%20Trading%3BMarketing%0AEMAIL%3BTYPE%3DWORK%2CINTERNET%3Ambriggs%40stcharlestrading.com%0ATEL%3BTYPE%3DWORK%2CVOICE%3A630-377-0608%0ATEL%3BTYPE%3DCELL%2CVOICE%3A217-415-8617%0AADR%3BTYPE%3DWORK%3A%3B%3B1400%20Madeline%20Lane%3BElgin%3BIllinois%3B60124%0AEND%3AVCARD”;

window.open(“data&colon;text/x-vcard;urlencoded,” + data);

}

</script>

</body>

</html>


Javascript to fire onclick of Download Contact button

Hey, @RJetson. Thanks for reaching out. Let’s see if we can get some thoughts on how you can approach this one — @albertsg @A_Wessolly @Sjardo have you built a similar functionality for vCard downloads and HubSpot Landing pages?

Thank you! — Jaycee

Hi @RJetson ,

you can use the CTA Tool for this. As you can see in this KB article Erstellen von Aufrufen zur Aktion (CTA) (Legacy) , you can choose “file Link” as your cta option. You can then select your Vcard file.

Hope this helps!
If my answer was helpful, please mark it as a solution.

Thanks for sharing, @WMM_Inbound :raising_hands: — Jaycee

@RJetson, wondering if you got this to work. I am working on trying to get contact information downloadable to phones.

@albertsg @A_Wessolly @Sjardo @Jaycee_Lewis - do you have any ideas? Is it possible to download to contacts on phones?