FWIW, MySpace also uses the fragment identifier, so this isn’t just a Shindig issue.
FWIW, MySpace also uses the fragment identifier, so this isn't just a Shindig issue.
Another item that was recently brought to my attention is the issue of relative URIs. The proxied rendering proposal includes a change to the general contract to allow for this, but it breaks down with fragments.
The options for relative urls are:
- Injecting a base element into the document. This works well in practice, but when the anchor is fragment relative, it goes to the base location, as the RFC for URIs mandates, even though this is almost never the desired behavior.
- Require that containers parse the document and perform relative URI canonicalization, special casing the anchor-only case. This is computationally expensive.
- Explicitly state that relative urls are not supported in the spec. This requires developers to always output fully qualified URIs.
On Fri, Oct 31, 2008 at 12:44 PM, Kevin Brown <et...@google.com> wrote:Another item that was recently brought to my attention is the issue of relative URIs. The proxied rendering proposal includes a change to the general contract to allow for this, but it breaks down with fragments.
The options for relative urls are:
- Injecting a base element into the document. This works well in practice, but when the anchor is fragment relative, it goes to the base location, as the RFC for URIs mandates, even though this is almost never the desired behavior.
- Require that containers parse the document and perform relative URI canonicalization, special casing the anchor-only case. This is computationally expensive.
- Explicitly state that relative urls are not supported in the spec. This requires developers to always output fully qualified URIs.
Some experimentation with popular apps from rockyou, slide, ilike, flixster, and buddypoke indicates that the last option is probably best. Developers can still specify a base element (even dynamically) if they really want relative uris.
On Wed, Oct 29, 2008 at 1:06 PM, Arne Roomann-Kurrik <kur...@google.com> wrote:Per John Hayes' comments in this thread:
http://groups.google.com/group/opensocial-and-gadgets-spec/browse_thread/thread/ef1f8d5a470bedae#
Containers have effectively laid claim to the rendered gadget's iframe url's page fragment identifier, as Shindig-based implementations use this field for storing the gadget security token (and some various other parameters).
This prevents developers from using some standard development practices, such as writing links that look like this:
<a href="#" onclick="callback();">Click me</a>
or jumping to different sections of a tall app view using:
<a href="#target">Click me</a>
...
<div id="target">Content here</div>
However, this restriction is not listed in the spec and confuses many first-time OpenSocial developers. We should clarify the gadgets spec to indicate whether gadget developers or the container should have ownership of this field. Personally, I don't have a preference (other than this be documented), so could some of the Shindig developers weigh in on this? As an additional consideration, my understanding is that limiting access to the page fragment will decrease the utility of the proxied content proposal (without some complicated rewriting on the gadget server's end).
~Arne
--
OpenSocial IRC - irc://irc.freenode.net/opensocial
3.1.) The following assumptions are made when implementing the gadgets specification:
3.1.1.) The container MAY choose to utilize the rendered gadget's page fragment for its own purposes. Gadget developers SHOULD NOT modify this value.
3.1.2.) The behavior of relative URLs in the gadget spec is undefined. Gadget developers SHOULD output fully qualified URLs, or inject a <base> element as described in 3.1.3.
3.1.3.) Containers MUST support the <base> element as described in the HTML 4.01 specification [http://www.w3.org/TR/REC-html40/struct/links.html#h-12.4]. Containers SHOULD move <base> elements encountered in a gadget's <Content> section into the rendered gadget's <head> element, as required by the HTML 4.01 specification.
This looks about right. I would like to suggest that we add a method to gadgets.util: scrollTo(item). This would be something that devs could depend on. One possible implementation of scrollTo is this:
function scrollTo(elemName) {
var elem = document.getElementById(elemName);
if (elem == null) {
var aTags = document.getElementsByTagName("a");
if (aTags != null) {
for (var i = 0; i < aTags.length; i++) {
if (elemName == aTags[i].getAttribute("name")) {
elem = aTags[i];
break;
}
}
}
if (elem != null) {
elem = elem[0];
}
}
window.scrollTo(elem.offsetLeft, elem.offsetTop);
}
The aTags version allows for one to mimic traditional <a href="#elemName"> user experience. Example usage:
<a id="top">Top</a>
<!-- html that does stuff is here -->
<div onclick="gadgets.util.scrollTo('top');">Go to top</div>
This seems to be in the same spirit as the other gadgets.util functions.
ok
+1
:max
That’s +5!