Annotations: Difference between revisions
BrettWilson (talk | contribs) |
BrettWilson (talk | contribs) (→Flags) |
||
Line 33: | Line 33: | ||
=== Flags === | === Flags === | ||
Flags could indicate whether an annotation is user-entered (e.g. notes) | Flags could indicate whether an annotation is user-entered (e.g. notes), automatic/service-entered (e.g. favicons, last visit date, etc.), or web page entered (as with IE's userData storage, this would need more aggressive limits). It could also store whether that annotation should be synced remotely or not, and possibly other bits. | ||
== External interface == | == External interface == |
Revision as of 00:33, 23 August 2005
Introduction
Annotations are provided by a browser service that can associate arbitrary information with URLs. The goal is to use them for both history and bookmarks.
Possible uses:
- Visit count (*)
- Last visit date (*)
- Fav icon
- Page thumbnail
- Notes
- Persistent storage for Javascript on the page
(*) May be stored in history instead (TBD)
Internal design
The design consists of two tables. The first maps URLs to internal IDs.
The second stores all annotations:
- URL ID
- Annotation name
- Value
- Expiration information
- Flags (perhaps combined with expiration information)
Expiration
Because some annotations can be large, and the number of pages can also become very large, some sort of annotation expiration scheme is required. Annotations beyond the expiration date will be deleted. The time frame must be variable because some annotations may be large and should expire faster, while others may be small and have minimal overhead for keeping them around. The option of never expiring will also be provided.
This time frame may be measured from annotation creation, but it could potentially be more valuable to measure from from last page access time: "this annotation expires after one month of page disuse".
Flags
Flags could indicate whether an annotation is user-entered (e.g. notes), automatic/service-entered (e.g. favicons, last visit date, etc.), or web page entered (as with IE's userData storage, this would need more aggressive limits). It could also store whether that annotation should be synced remotely or not, and possibly other bits.
External interface
Required operations:
- Get/set annotation "x" on this page
- Give me all the annotations on this page
- Give me all pages with annotation "x"="y" or "x" > "y", etc.
Issues: Namespacing of annotation names
IE's Implementation
IE has persistency for web pages called 'userData': http://216.239.63.104/search?q=cache:msdn.microsoft.com/workshop/author/behaviors/reference/behaviors/userdata.asp&hl=en&lr=&sa=G&strip=1 This information is persisted in the cache along with the web page it was written on. You can also pick other data stores, including favorites, history, and snapsnot (when saved to local machine).
Using IE's userData
In IE, you need to use DHTML behaviors (http://www.w3.org/TR/becss). Behaviors are not currently supported in Mozilla, but there exists an extension wrapping XBL that supports them: http://dean.edwards.name/moz-behaviors/
In CSS you add "behavior:url('#default#userData')" to the CSS for the elements that you want to persist. This overrides the get/setAttribute functions for that element. You can then call element.save(<store name>) to persist the element under the given tag <store name>.
Security
IE places limits on the visibility of tags to other web pages in the same directory and over the same protocol (to avoid https leakage). There are also limits placed on the size of the data, both for a given web page and for a given domain name.
IE allows an optional expiration date of stored elements. Since these attributes are stored in the cache/history/favorites, they probably disappear when the corresponding store is deleted. There doesn't seem to be any forced expiration, but given the relatively short lifespan of the cache, it probably doesn't matter.
Questions
- How is persistence shared across different pages in the same directory? Are the names just magically accessable to other pages?
- Are all tags for the saved object stored, or only the ones you setAttribute on?
- What happens if I set a given attribute from multiple pages with the same name but different values? Is the correct value distributed to all?