3 ms·
Single page apps seem like a hack to make browser apps feel like they are closer to native apps. Because most SPAs have a set flow, it seems like we should be
by madoublet 12y ago
Single page apps seem like a hack to make browser apps feel like they are closer to native apps. Because most SPAs have a set flow, it seems like we should be able to use prefetching to tell the browser what is most likely to happen next. For example, if you are on a list, then you can tell the browser to prefetch the details.
<link rel="next" href="details.html">
What I feel like is missing from this equation is a nice transition between pages. How nice would it be to have something like this:
<a href="details.html" transition="slide-left">Details</a>
If the browser prefetched the details and handled the transition, I would see no need for an SPA. We would get the benefits without having to implement a hack.
- Touche 12y agoSo if you have a list of 100 links you are going to prefetch all 100?
- madoublet 12y agoNo, that is not really the use of prefetch. It is for more predictable flows.
- e12e 12y agoAnd today you can use that markup and shim the transition you want with js - and still gracefully downgrade.
- toxican 12y agoBut wouldn't having it in the HTML mean you don't need the js? And then it wouldn't need to downgrade in modern browsers at all.
- e12e 12y agoIf you want to change the HTML spec and have something happen, you'd have to upgrade the browsers before anything happens... rel-links do work today, but transitions don't automatically work, and UI/UX (using the "forward"-arrow to go to "next" etc) is inconsistent or non-existent. But you can write some js to make them all work. And your HTML can be semantic and nice, and you can still get advanced features.
- WickyNilliams 12y agoI couldn't tell from your post, so just in case you weren't aware, browsers do support prefetching documents via link tags: http://www.w3.org/TR/html5/links.html#link-type-prefetch http://www.w3.org/TR/html5/links.html#link-type-prefetch
- svieira 12y agoChuckles IE used to support this with something called Inter-Page Transitions [1] - every time I saw it it made me double-take. <META http-equiv="Page-Exit" CONTENT="progid:DXImageTransform.Microsoft.Slide(Duration=2.500,slidestyle='HIDE')" /> That said, I wouldn't go down that road again. Better pre-fetching hints are good and HTML is a good place for a fallback (HTTP 2.0 provides better ways of doing it if you have control of the server), but page transitions are something better left to CSS, to my mind. [1]: https://msdn.microsoft.com/en-us/library/ms532847%28v=vs.85%29.aspx#Interpage_Transition https://msdn.microsoft.com/en-us/library/ms532847%28v=vs.85%...