Earlier quoted context omitted.
Ah, gotcha. So you are potentially returning more content then will be rendered, but still a faster situation then a full page reload. Thanks!
Well, no; when I say "arbitrary number of fragments", I mean there isn't a set limit established by the client code, not that the server should promiscuously return data the client may or may not actually need. A correctly designed application should never make a state transition that requires the server to guess about what the client's going to need to render.
Structured Page Fragments by YouTube
11–19 of 19 posts
Re: Structured Page Fragments by YouTube
#12Earlier quoted context omitted.
Well, no; when I say "arbitrary number of fragments", I mean there isn't a set limit established by the client code, not that the server should promiscuously return data the client may or may not actually need. A correctly designed application should never make a state transition that requires the server to guess about what the client's going to need to render.
Understood, which brings me back to the original question of wondering how exactly the server knows which fragments the client wants.
Re: Structured Page Fragments by YouTube
#13 In dynamic navigation, only fragments are sent, using JSON as transport.
Why not HTML as a transport?Re: Structured Page Fragments by YouTube
#14Re: Structured Page Fragments by YouTube
#15
$("#foo").on("ajax:success", function (e, data, status, xhr) {
$("#bar").html(xhr.responseText);
});
I thought rendering partials and dynamically replacing them has been a standard feature of most frameworks. Rails even renders a working link so the page works without the javascript.Re: Structured Page Fragments by YouTube
#16Interesting, but a lot heavier weight than the structural library that I built: http://intercoolerjs.org . From the docs: In dynamic navigation, only fragments are sent, using JSON as transport. Why not HTML as a transport?
Re: Structured Page Fragments by YouTube
#17Re: Structured Page Fragments by YouTube
#18Earlier quoted context omitted.
Understood, which brings me back to the original question of wondering how exactly the server knows which fragments the client wants.
Again, that's entirely a matter of application design. The general answer is that the server uses the request URI and HTTP headers to determine which fragments are needed, but there are as many specific answers as there are applications following this paradigm. (Said paradigm, incidentally, is just that of the single-page application; this is only YouTube's specific implementation of it. It sounds like you might get…
Re: Structured Page Fragments by YouTube
#19Earlier quoted context omitted.
Again, that's entirely a matter of application design. The general answer is that the server uses the request URI and HTTP headers to determine which fragments are needed, but there are as many specific answers as there are applications following this paradigm. (Said paradigm, incidentally, is just that of the single-page application; this is only YouTube's specific implementation of it. It sounds like you might get…
I appreciate your responses, but I think we got off track somehow. I'm quite familiar with the general architecture of SPA's... my question is specifically about how this library implements this feature. I didn't see anything in the docs about how to use URI or HTTP headers (or anything else) to specify which fragments you want -- instead it just says "?spf=navigate will be appended to the url". So I was wondering ho…
More complex state transitions such as form submissions appear to be provided for in the second argument of the spf.navigate method, which can take an object including a POST method specification and the corresponding data. It looks like that's about all the library provides in terms of request flexibility; per the code, setting custom request headers on navigation requests is definitely unavailable, but it doesn't do anything to override the default behavior by which XHR passes on e.g. Authorization headers already set by client code, so (in conjunction with e.g. OAuth) you'd be able to identify and authenticate the user making the request. I guess the idea is that, for the purpose the library's meant to answer, what it provides in the URI is just about all the information the server should need on what content to include in the response.