Add a contact to the mobile device Address book from an HTML webpage

25,721

Solution 1

You might have to attack this from the device side of things instead. If that's what you end up doing try a cross-platform framework.

Not sure what your flexibility is, but for cross platform device integrated application I highly recommend PhoneGap. Plus, sounds like you've got some experience in HTML5 and CSS already. This could handle your contacts integration pretty easily across devices.

Solution 2

W3C defined Contacts API as a working draft but as far as I tested it's not supported in iOS devices(I have iPad with iOS4 and iPhone with iOS 5). You should test some android devices and tell us if they support Contacts API or not. That would be useful for future readers.

In case you have contacts api supported you can do this:

if(navigator.contacts){
   var mycontacts = [];
   navigator.contacts( ['emails.value', 'name', 'friends'],
                         function(contacts) { 
                           for(i in contacts) {

                               mycontacts.push(contacts[i]);

                         } );
}

Solution 3

The first Idea i got was to use for Android (most Android-User, have a Google-Account) the Google-Contact-API.

Share:
25,721
Fredy31
Author by

Fredy31

Fredy31 is a young web integrator from Montreal Canada.

Updated on July 09, 2022

Comments

  • Fredy31
    Fredy31 almost 2 years

    I'm currently building a site where, with one touch, you should be able to add a contact to your IPhone/Android Address book. The website is currently HTML5, but Javascript and/or PhP options could be implemented.

    So is there a way that on the click of a link, the mobile device will open the Adress book already filled with the info I want it to have (Name, EMail Address, Street Address, Phone number).

    I've looked everywhere to only find ways to program apps that would do the same thing. I want to make it from a webpage. Anywhere I can learn how to do this?

    PS: Currently, I'm trying with everything in a .VCF file that could be downloaded on the click... this seems to lead me nowhere at the moment.

  • Fredy31
    Fredy31 over 12 years
    I don't know if you answered the wrong question, but your answer doesn't make sense with the question.
  • Enrique
    Enrique over 12 years
    can you explain why? you are asking for a way to add contact info with a click from a webpage in HTML, and putting a QR code with the contact information can do that if you have qr droid installed
  • Enrique
    Enrique over 12 years
    that's exactly what I'm saying, you can add the contact info directly to your address books, contact list etc with a QR code generated for that. QR Droid detects that you have contact info in your QR code and let's you add that information directly to the contact list. You can create the QR with QR droid too. Video here: youtube.com/watch?v=BXCColkqV8I also here is an online generator for QR with contact information zxing.appspot.com/generator (test it with QR droid and you will see that you can add that information directly to your contact list)