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

Hi,

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.)

-Anssi

[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