okfn/annotator — Issue #86: How should we work out the canonical URL of the current page?
Author: nickstenning
Created: 2012-02-05 17:51:46+00:00
State: open

In a recent email, Ivan Djordjevic raises the point that if the AnnotateIt bookmarklet is used on a YouTube page, then the "uri" that is added to each annotation is `http://www.youtube.com/watch` rather than `http://www.youtube.com/watch?v=E_XwdmLAHi4&feature=related`.

This is a bit of a sticky problem, as there's no general way to distinguish which query params are important to page content and which aren't. In this example, omission of `feature=related` would give us the same page, while obviously omission of `v=E_Xw...` does not.

I propose we implement a plugin, say, `UrlDetect`, which does something a little more advanced -- in particular, it detects special cases like Google searches and YouTube video pages -- than the current solution:

```uri = location.href.split(/#|\?/).shift()```

and automatically updates the appropriate field in `annotationData` if the Store plugin is loaded.