Le 23/05/2014 10:04, Michael Heuberger a écrit :
"single page app" usually means that no interaction in a given page will
fallback to using links and forms if there is a problem with JS).
It does not mean that all HTML templates are on the client nor that you
serve the exact same thing for every URL be they 200s or 404s. That's an
definitely an option, but it's one you impose upon yourself.
- Display a beautiful 404 page and hide parts of the navigation
- Reveal navigation history to give users a better usability experience
- And many more …
I agree with those entirely but couldn’t they also be achieved by including the
correct scripts on the 404 page issued from the server?
No, it is a single page app. All the HTML templates are on the client
side and loaded once during page load. And everything happens
dynamically. In other words: You load everything once, then there is no
further interaction with the server unless it's a specific query for
data or alters data in the database.
Serving different content based on different URLs (and status) actually
does make a lot of sense when you want your user to see the proper
content within the first HTTP round-trip (which saves bandwidth). If you
always serve generic content and figure it all out on the client side,
then either you always need a second request to get the specific content
or you're always sending useless data during the first generic response
which is also wasted bandwidth.
On this topic, I recommend watching  which introduces the idea of
"critical rendering path". Given your focus on performance and
preventing wasted bandwidth, I think you'll be interested.
If all the HTML resides in the app, not on the server, then it wasn't
served via HTTP, so there is no 200 or 404 to inform about (since no
HTTP request occured).
Furthermore you can convert a whole single page app into an iPhone app
with PhoneGap. All the HTML resides in the app, not on the server.
the right to know if the HTTP request resulted into a 200 or a 404.