Re: Contacts API updates

Hi,

On 13.1.2011, at 11.25, ext Rich Tibbett wrote:

> On Wed, Jan 12, 2011 at 7:01 PM, Anssi Kostiainen 

> > <a id="vcard">Save Contact</a>
> >
> > <script>
> > var vcard = 'BEGIN:VCARD\n' +
> >            'VERSION:3.0\n' +
> >            'N:Doe;John;;;\n' +
> >            'FN:John Doe\n' +
> >            'TEL;type=CELL:123456\n' +
> >            'END:VCARD';
> >
> > document.getElementById('vcard').href = 'data:text/x-vcard;charset=utf-8,' + encodeURIComponent(vcard);
> > </script>
> 
> > Your use case is IMO valid and is an alternative ready-to-use-today way of saving objects to the user's device.
> 
> Feel free to use it in your examples :-)
> 
> I shall and thanks again for your insight :)

While reading the vCard specs I found a minor bug in my example: the lines should be terminated with CRLF (\r\n). It's good to get these details right especially if the example ends up in the spec (copy-pasting example code is not uncommon).

-Anssi

Received on Friday, 14 January 2011 11:08:28 UTC