W3C home > Mailing lists > Public > public-device-apis@w3.org > February 2011

Add/update via window.location (was: vCard and vEvent microdata in HTML5)

From: Anssi Kostiainen <anssi.kostiainen@nokia.com>
Date: Thu, 3 Feb 2011 13:19:04 +0200
CC: "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-ID: <7D4B373C-4D61-412E-B36D-2CC7AB71692E@nokia.com>
To: ext Rich Tibbett <rich.tibbett@gmail.com>

On 28.1.2011, at 19.09, ext Rich Tibbett wrote:

> Perhaps an example, section or a couple of sentences are need to explain how this microdata fits in to the Device API specs.

[Not directly Microdata related, but inspired by the examples in there.]

Here's an alternative mechanism to add and update contacts (/calendar entries/you-name-it):

window.location = 'data:text/x-vcard;charset=utf-8,' + encodeURIComponent(vcard);

The use of window.location assignment fits nicely in the event-driven programming model. This way any add/update operation can be invoked programmatically on load, click, keypress, mouseover etc. as well as in inline script.

The <a href>-based mechanism I proposed earlier requires either user to click the link or script to call the click() [1] method on the <a> element. The click() method may not be widely supported for a while, so window.location provides an alternative backward-compatible mechanism.

I'd suggest we add this alternative mechanism to [2] (and also keep the <a href>-based one).

(I assume we'd like to keep the Contacts examples on the bleeding-edge and sync with Calendar examples later on while we still iterate. So perhaps it wouldn't hurt to add a note to Calendar stating that for the latest add/update examples look for Contacts, they're very similar apart from obvious MIME type and vCard vs. iCalendar format diffs.)


[1] http://dev.w3.org/html5/spec/Overview.html#activation
[2] http://dev.w3.org/2009/dap/contacts/#adding-and-updating-contacts
Received on Thursday, 3 February 2011 11:20:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:32:25 UTC