The Code Train

Where Neil Crosby talks about coding on the train…

RSS Entries

Adding a vCard to your iPhone Address Book from a web page

Posted on November 29th, 2009 by Neil Crosby. Filed under Blog Posts.

It can’t be done. Well, not obviously anyway.

A couple of weeks ago, I realised that my public vCard was less useful than it might be. One of the specific reasons that I created it was to make it easy for people to add a bunch of my contact information to their address books when I met them, rather than them having to manually type in a whole load of stuff that was on a business card. It turns out that this is great when that person’s sat at their own computer, but if they’re (for example) using an iPhone then things become a little more difficult.

You see, the iPhone doesn’t like to use MobileSafari to download files. That’s fine in general – you don’t get a filesystem to peruse on the iPhone, so the only way that downloads would be useful is if the iPhone already knows what to do with them. That’s why applications are allowed to register their own custom URL schemes.

Unfortunately, by default the iPhone only registers a few URL schemes for use within web pages – mailto:, tel: and sms: as pseudo protocols, as well as specific URL structures for Google Maps, YouTube and iTunes links. This makes it impossible to do things like adding an address to the Address Book or an event to the Calendar with a single click on a link in a webpage – you just get a message that reads “Download failed. Safari cannot download this file”.

This is clearly a pain. As a phone, it seems reasonable that you should be able to easily add contacts to your Address Book. Unfortunately, either Apple thinks you shouldn’t be able to do this from a webpage or they just didn’t consider it as a usecase.

It turns out that they did consider that you might like to open email attachments though. If someone sends you an email that contains a VCF file then you are able to open it and see its contents. If you then scroll down to the bottom of the file you’re greeted with two options, allowing you to “Create New Contact” or “Add to Existing Contact”. Suddenly a world full of contact adding goodness is opened up to you.

So, what I’ve decided to do with my vCard is a little bit of user agent sniffing in my PHP. Currently I assume that every other device in the world other than the iPhone will do something sensible with the normal VCF file (or the microformatted data that’s on the page itself), so I listen out for the iPhone’s user agent. If I see it then I swap out the link to download the VCF file with one that takes the user to a page containing a form allowing them to enter their email address. Once they do, the VCF file is immediately emailed to them and they can add my card to their address book.

Right now the look and feel of the the email form that iPhone users are directed to could be described as rudimentary at best, but it works. At some point in the future I’ll get round to making it look a bit more pretty.

As a solution, I’m fairly happy with this. Whilst it’s nowhere near as nice as being able to simply click on a link and add a contact to your address book, it does at least mean that it becomes possible to add a contact from a web page. Certainly it’s a better solution than not allowing users access to the content at all. It’s also entirely possible that this solution would work for other filetypes, such as calendar events.

My only concern is that this problem may be in existence in other devices other than the iPhone as well. It would almost certainly make sense to make the email option available to users of other devices as well.

So there you have it – to allow a user to add a contact to their Address Book from a webpage on the iPhone don’t try and get them to download it, let them receive it via email instead.

Tags: , , , , , , ,

If you enjoyed this post, subscribe to The Code Train and read more when I write more.

57 Responses to “Adding a vCard to your iPhone Address Book from a web page”

  1. Damn! I’ve been struggling with this myself. It’s the sort of pig-headed obstinance that gets Apple a bad name. A simple enough thing to do, and so far every other mobile phone I’ve tested handles it correctly. Your solution is fine in some circumstances, but still an inexcusable break in the user experience. Bad Apple!

  2. I’ve been trying to solve this problem for a while – with no solution. A couple of companies use the solution you highlight in your blog, but surely.. there must be a way to do this?!

    If you find anything, I would love to hear from you!


  3. The blackberry has the same issue. Lets hope they fix this soon

  4. Thanks for the info, Neil! Was just beating my head about this and now you’ve offered a workable solution. :) Hopefully the companies making phone software will realise that people do actually get files from a browser in such a way and support it better.


  5. Wow! Life saver! Thanks :)

  6. Hi Neil,

    thanks for the hint. But on my iPhone (OS 3.1.2) it does not work. It says “Safari cannot load this file”.

    Oh well, I see. It works with the “standard”-mail-app. But not when I read the web-mail via Safari.

    Oh man, didn’t thought this causes so much trouble. Thanks, Neil, for providing this solution. Stefan

  7. Would you be able to share the code?

  8. @Ben – sorry about that, sharing the code would absolutely be the Right Thing™ to do, wouldn’t it? I’m not quite sure how I forgot to do it the first time around to be honest, since it’s up on GitHub!

    So, in all its glory here’s a link to the proof of concept iPhone vCard downloadification code.

  9. I found an even better way to add vcard information from a website. I just blogged about this on my site and it involves using the new Microsoft color barcode tags to create vcards on their site and then exporting an image for use on printed business cards or wherever.

    I posted an image on my site that contains just a URL, but it works when taking a picture of the image using the iPhone app: TagReader. Other mobile devices are supported too.

    This way, bloggers can post an image of their tag online and people who want to save the information to their phone can do so by taking a picture of the screen.

    Check out my full blog post here:

  10. I found a way to do it with just a few required clicks useing Google maps! If you would like to know how, read on my HowTo-side..

  11. Seems like you’ll need to update your post Neil. :)

    Try Qrafter for iPhone. You’ll see that you can download a complete vCard using it. To learn more, see:

  12. This is the solution we implemented at We make it easy for the people you email to grab your contact info – regardless of what address book they use. Thanks for the tutorial!

  13. Thanks Neil, after doing a lot of research I implemented the solution, that you’ve described here! Although there are a few other solutions out there by now they all have their downsides and yours is the best workaround I could find.

  14. Such a simple solution and it had escaped me! Thanks for the form idea! Apple continues to be a live hate relationship for me, the iPhone is awesome, but little cr*p like this is very frustrating… Wish they would get their act together with Adobe and integrate FLASH!, how freaking’ stupid is that!? I also wanted o suggest that you can do a simple link on youelr webpage using the “Mail to:________?attachment”, and link to the vCard so end up as an attachment to the email and the end user can mail the vCard to themselves… A little crude, but works. ONWARD!

  15. what do i have to put where???? yeah I’m a newbie.

  16. Did iOS 5 fix this?

  17. Just tried downloading this vCard file ( on my iPhone 4S…and it doesn’t let me add it to my addresses.

    So, I guess iOS 5 still doesn’t handle vCards correctly.

  18. If you happen to have Tap Forms installed on your iPhone then iOS 5 allows you to download the VCF file and send it to Tap Forms, and then Tap Forms can create a new Contacts entry. It’s a bit tortuous but it works.

  19. Have you considered turning your contact information into a QR code?

    Most cell phones here in Japan are capable of transferring contact information via an IR port. The iPhone, however, lacks this capability. I’ve gotten around it by turning my contact information into a QR code, which other people can scan and then save as contact information.

  20. The problem with creating a QR code for your downloadable contact information is that a high percentage of users are NOT trying to get your contact info directly from your printed business card they are trying to get it while already on your mobile site. So unless they happen to carry around 2 iphones (one to pull up the QR code and one to snap it) it is useless for this use case. Its actually not even a problem with iOS its a problem with the safari browser. Even the android browser had difficulties with this that haven’t been corrected at the browser level. At least with android a simple .htaccess correction fixed the problem and allowed you to download .vcf files to the contacts. With safari though this is still a problem and the php solution to email the .vcf file is the only working solution that i have heard of or seen. Using google maps to get what you want is a clever solution but lets face it if iphone users were clever it really wouldn’t be that hard for them to get your contact info into their phones so as developers we keep drudging through work arounds to get people that think their phone is amazing to keep believing it! Good luck i look forward to this being the next standards issue for cross platform development, lol.

  21. Thanks very much, Neil. This is really helpful!! Also thank you Jan-Hendrick. I didn’t think of that at all. Kerem Erkan, Thank you, also. I love that Qrafter finally does this correctly (allegedly – I havent tried it yet)… but lose the smugness (and it’s customary here to disclose when you are pushing your own app). We are the vcard publishers. Not the people with scanners. It doesn’t matter what scanner we have. It matters what scanner the people we meet have. And when I get really lucky and stumble into someone that knows what QR is, sadly they typically don’t have your scanner.

  22. Hmm, sorry if my comment looked like it was written in full smugness, I was trying to be more friendly. Anyhow, point taken!

  23. I dont have an iphone, I have an android. Which makes testing exciting! In light of all the posts, and the time since this was coded, is this still a needed piece of code? Or are all you apple users now able to import vcf files? Either way, thank you Neil for your work, and for sharing it so generously. Its very much appreciated, and thank you to all the above who added. I truly appreciate all the time you have all given so willingly and freely.

  24. Well it doesn’t work… it works only when i arrived an email. Then i can import the attached vcf card…

    I have found an site. you must register and put you name … in the site… u get an qrcode with the link to ure own vcard site and there it is possible to send the vcf from the site to you… i find it great! is the url…


  25. I have just published an alternative solution on my blog which describes how to attach the contact file as an attachment to a calendar file which is handled by mobile safari. Please have a look…

  26. iOS6 doesn’t contains Google Maps anymore, so you get redirected to the Google website, which s*cks

  27. Check out my fix for the same issue, will be sharing the secret sauce soon. I didn’t like the idea of making the users type in their email address on mobile, because no matter how good soft-keyboard “x” is, it’s still better to not have to type at all. You can view my solution at

    Andrew Rodgers

  28. “Adding a vCard to your iPhone Address Book from a web page

  29. You think they would have fixed this in iOS6. So stupid.

  30. I’m not that much of a online reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your site to come back down the road. All the best

  31. Excellent goods from you, man. I’ve understand your stuff previous to and you are just extremely great. I actually like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it enjoyable and you still care for to keep it wise. I can’t wait to read far more from you. This is actually a terrific site.

  32. I know this if off topic but I’m looking into starting my own weblog and was wondering what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet smart so I’m not 100% sure. Any suggestions or advice would be greatly appreciated. Cheers

  33. Attractive section of content. I just stumbled upon your web site and in accession capital to assert that I acquire actually enjoyed account your blog posts.

    Any way I will be subscribing to your augment and even I achievement you access consistently quickly.

  34. Heya i am for the first time here. I found this board and I find It really useful & it helped me out a lot. I hope to give something back and help others like you aided me.

  35. What’s up mates, nice paragraph and good arguments commented at this place, I am genuinely enjoying by these.

  36. Hello, always i used to check web site posts here early in the break of day, because i love to find out more and more.

  37. Usually I don’t learn post on blogs, however I would like to say that this write-up very compelled me to take a look at and do so! Your writing style has been surprised me.

    Thank you, quite great article.

  38. Valuable info. Fortunate me I discovered your site by chance, and I’m shocked why this accident did not happened earlier! I bookmarked it.

  39. What’s up, after reading this remarkable post i am too delighted to share my familiarity here with friends.

  40. Howdy very cool web site!! Man .. Excellent .. Superb .. I will bookmark your blog and take the feeds additionally? I’m satisfied to find so many useful information right here within the publish, we need work out extra strategies on this regard, thanks for sharing. . . . . .

  41. Sweet blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News?

    I’ve been trying for a while but I never seem to get there!


  42. If you can find plastic screws or hinges, the cups are likely a phony. Shades come in many designs, and every one of them is designed to fit particular forms of encounters and looks.

  43. When a youngster becomes an adolescent, they suddenly commence to want to have additional liberties and independence. It has not been very long, since the cellphones began to include the digicam establishments.

  44. Well, it’s 2014 now. What’s the conclusion on this? Also, is it possible on Android? Because I want this topic covered on this website I think that people still prefer paper in their hands, and you can leave better impression with handing someone a nice business card, but vCards have their own advantages.

  45. I really like what you guys tend too be up too. This sort of clever work and reporting! Keep up the great works guys I’ve incorporated you guys to mmy own blogroll.

  46. There are actually certainly plenty of details like that to take into consideration. Which is an awesome point to bring up. I offer the thoughts above as general inspiration but clearly one can find questions like the 1 you bring up where essentially the most vital factor is going to be working in honest superior faith. I don?t know if best practices have emerged around items like that, but I am certain that your job is clearly identified as a fair game. Both boys and girls really feel the impact of just a moment’s pleasure, for the rest of their lives. cheap sneakers

  47. Don’t let the economy move you lower, start using deals. Should you forget your youngster everyone understands which they won’t produce to their fullest possible.

  48. Good day! I know this is kinda off topic but I was wondering which blog platform are yyou using for this site? I’m getting tired of WordPresss because I’ve had issues wifh hackers and I’m looking at options for another platform. I would be awesome if you could point me iin the direction of a good platform.

  49. Nice post. I learn something totally new and challenging on sites I stumbleupon everyday. It will always be helpful to read content from other writers and use a little something from their web sites.

  50. Veryy soon this website will be famous amid all blogging people, duee to it’s nice articles or reviews

  51. If you are moving house and have to transfer your legitimate artwork collection obtain a image field, it’s the only way to go in style.

  52. Very Good website loads of tremendous steam shower info here

  53. Some fans have their rooms with printed images of Leonardo, Michelangelo, Donatello and Raphael. He is an honest line hugging the Teenage Mutant Ninja Turtles costume accessories for sale and to the other side of the combination. The fact is that all weapons used for war, from whatever time period and from all geographic locations and cultures qualify as martial arts weapons.

  54. Are you positive tbry are not sleeping… by the way i adore you book. drums girls and dangoues pie

  55. Hello, i believe that i saw you visitrd my wwblog thus i got here to return the favor?.I am attempting to in finding things to improve my website!I guess its adequate too make use of a few oof your ideas!!

  56. Hi, I desire to subscribe for this blog to obtain latest updates, therefore where can i do it please assist.

  57. Good info. Lucky me I recently found your website by accident (stumbleupon). I have saved it for later!

Comments RSS

Leave a Reply

TheCodeTrain Theme by Neil Crosby, Powered by WordPress