Download a vCard on Android or iPhone

If you visit my homepage using a mobile device, you will see that the design is slightly different. Plus, you will be able to download my vCard.

By default, if you don’t specify anything, Apache is not able to understand the .vcf extension, and serves the file as plain/text, which is bad!

Android sees it as a text file and lets the browser open it instead of opening the Contact application. Same as for the iPhone. I had to find a workaround.

Serve a vCard for Android

Android is able to handle vCards, as long as their mime-type is text/x-vcard. The easy view is to add this type to your htacces file and an Android user will have his contact application opened up when he clicks on your vCard file!

  ForceType text/x-vcard
  Header set Content-Disposition attachment

Serve a vCard for iOS/iPhone

As usual when Steve decided that you cannot do something, you cannot find a workaround. Well… Steve decided it is not worth being able to download a vCard from the browser…

There is no easy way to enable the iPhone user to download your vCard and add it to its contact list.

But there are some hacks you can use.

The first one is

  • Detect the iPhone
  • Asks the user his email address
  • Send him your vCard by email

Believe it or not, the Mail app is able to handle vCards, but not Safari.

The second one is to create a Google Places entry, because the Google Maps application can handle Google Places.

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} .*Mobile.*Safari
RewriteRule ^(.*)vcard.vcf$

I currently implemented none of them on my site. I don’t know if iPhone users are worth the effort 😉

You can try to download my vCard.