How to add a contact to the iPhone's Address Book from a Web Page?

Viewed 47878

In the desktop Mac world, if I were to click on a link in a web page which linked to a VCF file, this file would be opened in the Address Book application. In the iPhone world, however, doing that results in the message "Download failed. Safari cannot download this file" being displayed. So, my question is, is it actually possible to add a contact to your iPhone's Address Book from a web page?

I have both the original VCF file and an hCard microformatted version of the data available to me, so the solution does not have to be tied to downloading the original file - I'm able to reprocess the data if necessary. The only requirement is to add the contact to the iPhone's Address Book from a webpage being viewed from within Mobile Safari.

So, any ideas?

5 Answers

I was able to get this working on a web app using the following resources:

  • vCards-JS - Simple API for creating a vCard. The example in the Readme shows how to create a vCard, assigned to variable vCard
  • Stack Overflow Post: "Download data url file" - Replace "helloWorld.txt" with vCard.getFormattedString(). the filename (i.e. name argument) should of course end in .vcf as well.

Confirmed working on Android, IOS and Outlook.

Related