Open Bug 394777 Opened 17 years ago Updated 2 years ago

Allow content creators to add microformat buttons to their Web pages

Categories

(Firefox :: General, defect)

defect

Tracking

()

People

(Reporter: faaborg, Unassigned)

Details

(Whiteboard: [microformats])

Attachments

(1 file)

Extensions like Operator allow the user to take action on microformatted content (like sending an address to their address book, or an event to their calendar), but it is not currently possible for Web designers to add UI widgets to their pages that complete similar actions.

This bug is for tracking the various approaches to achieve this functionality.
Here is a mockup of the type of functionality that would be exposed to Web site designers.
Whiteboard: [microformats]
Possible option: special class, recognized by microformat aware browsers and converted to a hyperlink.

Example:

<div id="hcard-Alex-Faaborg" class="vcard">
 <span class="fn">Alex Faaborg</span>
 <div class="org">Mozilla</div>
 <div class="adr">
  <div class="street-address">1981 Landings Dr. Building S</div>
  <span class="locality">Mountain View</span>
,
  <span class="region">CA</span>
,
  <span class="postal-code">94043</span>
  <div class="user-action-addressBook" style="visibility:hidden">Add to Address Book</div>
 </div>

The text "Add to Address Book" is hidden by default, unless the browser (or an extension) recognizes user-action-addressBook, in which case the text is rendered as a hyperlink, and clicking it sends the structured data in the hCard to the user's address book.

This is a bit of a hack, but it is also considerably easier than asking the author to write javascript to check navigator.userAgent, know which browsers handle microformatted content (and subsequently update this as it changes), and then display the link accordingly.  Also, I'm interested in allowing user generated microformatted content to be added to blogs and wikis where javascript is not commonly allowed.

Problem: The web author wants to control the visibility themselves (for instance the button only appears when hovering over the microformatted content).
Possible option: new protocols

We could create protocol handlers for each generic application type (map://, addressBook://, calendar://).

Example:

<div id="hcard-Alex-Faaborg" class="vcard">
 <span class="fn">Alex Faaborg</span>
 <div class="org">Mozilla</div>
 <div class="adr">
  <div class="street-address">1981 Landings Dr. Building S</div>
  <span class="locality">Mountain View</span>
,
  <span class="region">CA</span>
,
  <span class="postal-code">94043</span>
  <div><a href="addressBook://blog.mozilla.com/faaborg/about/#hcard-Alex-Faaborg">Add to Address Book</a></div>
 </div>

I do like really like the idea of being able to reference microformats elsewhere on the page, or on any other page.  Also this design might encourage people to reference information instead of duplicating it (not sure if that is good or bad).  There are a number of very clear problems however: 

Problems:

1) Normally content creators would expect to send the data by value instead of by reference, for instance:

 mailto://name@domain.com?subject=this is the subject?body=this is the body

(although I'm not really sure how commonly known this is)

2) Since the information is still being transported using http, using a new protocol in the URI would be technically inaccurate.

3) If you change the scheme from http, you can't have a relative URI, you have to create an absolute one:

   Relative URI references are distinguished from absolute URI in that
   they do not begin with a scheme name.  Instead, the scheme is
   inherited from the base URI
		http://www.ietf.org/rfc/rfc2396.txt

This could be a problem for content creators because in most cases they would want to reference the microformat they are currently in, but they may not know what its URI is going to end up being, or they don't want to take the time to figure it out.  It would also be impossible for creators (like the hCard creator) to know what the URI is eventually going to be.
Possible option: URI scheme.  Suggested by Manu Sporny on microformats-discuss@microformats.org

Example:

<div id="hcard-Alex-Faaborg" class="vcard">
 <span class="fn">Alex Faaborg</span>
 <div class="org">Mozilla</div>
 <div class="adr">
  <div class="street-address">1981 Landings Dr. Building S</div>
  <span class="locality">Mountain View</span>
,
  <span class="region">CA</span>
,
  <span class="postal-code">94043</span>
  <div><a href="action://addressBook/add/#hcard-Alex-Faaborg">Add to Address Book</a></div>
 </div>
Possible option: Javascript

Example:

<div id="hcard-Alex-Faaborg" class="vcard">
 <span class="fn">Alex Faaborg</span>
 <div class="org">Mozilla</div>
 <div class="adr">
  <div class="street-address">1981 Landings Dr. Building S</div>
  <span class="locality">Mountain View</span>
,
  <span class="region">CA</span>
,
  <span class="postal-code">94043</span>
  <script type="text/javascript">
 	if (navigator.microformatAware("hCard")){
  	document.write("<a href='#' onclick='navigator.sendToAddressBook('hcard-Alex-Faaborg')'>Add to Address Book</a>");
  	document.write(", ")
  	document.write("<a href='#' onclick='navigator.sendToMap('hcard-Alex-Faaborg')'>Send to Map</a>");
  	}
  </script>
 </div>
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: