Re: Proposal: Navigation of JSON documents with html-renderer-script link relation

On 2/11/2011 7:15 AM, Julian Reschke wrote:
> On 11.02.2011 14:48, Kris Zyp wrote:
>> Increasingly, web applications are centered around JSON-based content,
>> and utilize JavaScript to render JSON to HTML. Such applications
>> (sometimes called single page applications) frequently employ changes to
>> the hash portion of the current URL to provide back/forward navigation
>> and bookmarkability. However, this is largely viewed as an awkward hack,
>> and is notoriously problematic for search engines (Google has a hash to
>> query string conversion convention, which is also highly inelegant). We
>> need support for first class navigation of JSON documents, while still
>> leveraging HTML rendering technology.
>> ...
>
> Sounds very interesting.
>
> Did you consider making the link point to an HTML(+Script) page, and
> placing the JSON object into that pages script context somehow?

Yes, I had considered that. However, I believe that most webapps that
would use this API would be doing mostly JavaScript based rendering, in
which case the HTML just seems to add an extra layer of indirection for
loading a script. I would think most applications would want to get a
script loaded right away, so I wrote the proposal based on that use
case. That being said, I have no strong objection to having the JSON
response link to an HTML page instead of a script. Loading HTML could
possibly make it easier to reason about the order and timing of multiple
script loads.

>
> Or maybe even XSLT (all we'd need was a standard to-XML mapping).

Yes, although my proposal dealt with JSON (although the same
API/approach could be applied to XML documents) which doesn't apply to
XSLT, and there isn't a single transform/templating standard for JSON.
There are numerous JSON templating libraries out there, but by loading a
script, an author can easily load their favorite JSON templating library
and perform the tranformation (to HTML). If one templating engine really
become popular, it seems like it could be reasonable to have direct
support for that in the browser someday (with maybe a
"html-renderer-mustache" relation, for example), although personally I'd
prefer something more CSS like to describe the presentation of JSON. The
door is wide open for future relations and handlers.
Thanks,
Kris

Received on Friday, 11 February 2011 14:40:38 UTC