Save contact, email and phone by clicking a link

Asked

Viewed 4,210 times

2

I was wondering if that’s possible, because I have a client who wanted to do this, I don’t think so. As the title says, I need to click an image (this on the cell phone, of course) save or at least go to the cell phone part of contact registration.

Has anyone ever seen anything like it? Do you know if you can do it?

I know what you can do with the phone call:

<a href="tel:110000000">Telefone</a>
  • The most practical way to do this is by using AJAX, read a little about it and you’ll probably be able to solve this problem. Note: Only with PHP is possible too, but that would only be with Reload, so everyone opts for AJAX.

1 answer

3

Is not possible, HTML5 and Javascript Apis do not allow such interaction, it would be cool if there was a window that opens asking if the user would like to save, but there is no such functionality.

On iOS (iPhone) holding the touch on the link gives the option Add Contacts:

Add Contacts iOS

I believe it is as much as possible with HTML, however Talve Vcard can help, if you create a document with the extension .vcf (and the http server is configured with Content-Type correct) or else set the header of a dynamic server-side script (such as php) Content-Type: text/vcard, with a format similar to this:

BEGIN:VCARD
VERSION:3.0
N:Doe;John;;;
FN:John Doe
ORG:Example.com Inc.;
TITLE:Imaginary test person
EMAIL;type=INTERNET;type=WORK;type=pref:[email protected]
TEL;type=WORK;type=pref:+1 617 555 1212
TEL;type=WORK:+1 (617) 555-1234
TEL;type=CELL:+1 781 555 1212
TEL;type=HOME:+1 202 555 1212
item1.ADR;type=WORK:;;2 Enterprise Avenue;Worktown;NY;01111;USA
item1.X-ABADR:us
item2.ADR;type=HOME;type=pref:;;3 Acacia Avenue;Hoemtown;MA;02222;USA
item2.X-ABADR:us
NOTE:John Doe has a long and varied history\, being documented on more police files that anyone else. Reports of his death are alas numerous.
item3.URL;type=pref:http\://www.example/com/doe
item3.X-ABLabel:_$!<HomePage>!$_
item4.URL:http\://www.example.com/Joe/foaf.df
item4.X-ABLabel:FOAF
item5.X-ABRELATEDNAMES;type=pref:Jane Doe
item5.X-ABLabel:_$!<Friend>!$_
CATEGORIES:Work,Test group
X-ABUID:5AD380FD-B2DE-4261-BA99-DE1D1DB52FBE\:ABPerson
END:VCARD

When opening on your phone is likely to see a screen similar to this:

vcf no iphone

Then the user will notice the "Open in Contacts" (in cell phones in Portuguese the text will be in Portuguese, do not worry)

Source: https://www.w3.org/2002/12/cal/vcard-examples/

  • Thanks, Gui. I will test this way you recommended.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.