Hacker News new | past | comments | ask | show | jobs | submit login

Sure it could. But this is also about providing a better user experience. Being able to automatically split the bundle into parts, the most needed of which is loaded at first and the rest then loaded afterwards in the background using a service worker, means that navigation will be far more snappy and provide better feedback to the user. Rather than waiting for the HTML to be downloaded when a link is clicked, most of the UI can be displayed while a smaller payload is downloaded. Obviously if your content is 100% static and your target group is people who only have 2G available, this might not be the best choice.

> then things like the back button after scrolling through the blog would work.

What do you mean?

> Why try to outsmart the browser?

Not sure how this is outsmarting the browser.




If you prefetch the HTML of the page, the browser will have it in its local cache, so clicking the link will be instantaneous (304 Not Modified).

Regarding the back button, you can see the mis-behavior here: 1) Go here: https://zeit.co/blog 2) Scroll all the way down to the bottom 3) Click a link 4) Click back

Expected: Page returns to exactly were you left off Actual: You are scrolled to a random blog post

My overarching question is why any type of SPA is needed for a site like zeit.co?


>But this is also about providing a better user experience.

Breaking the behavior of my back button is one of the worst user experiences I get these days. Usually it makes me so angry that I just leave the site right away.

> Rather than waiting for the HTML to be downloaded when a link is clicked, most of the UI can be displayed while a smaller payload is downloaded.

Browsers can do that on their own since forever, given a carefully crafted HTML page. Of course there are use cases where that is not enough, needing some load-on-scroll mechanism or something like that, but it gets abused all the time for things a browser could handle so much better (with proper HTM of course) - blobs, newspaper articles etc.


> Breaking the behavior of my back button is one of the worst user experiences I get these days. Usually it makes me so angry that I just leave the site right away.

Obviously that is not the wanted user experience. Disregarding SPAs as a solution because of an unintended behaviour is kind of throwing the baby out with the bath water.

> Browsers can do that on their own since forever, given a carefully crafted HTML page.

How are you rendering parts of something from a server before receiving anything from the server using only HTML? I'm talking about the following flow:

1. User clicks link

2. Instantly the layout etc. is rendering using JS, with fancy loading elements (maybe ala how FB does their news feed) for the missing items

3. The data is loaded and put into the layout

Whereas for the non-SPA flow the user would have to wait for data to be received before anything is rendered. Of course pre-fetching alleviates this a bit, but it still requires the whole page to re-render.


How do you leave the site if the back button doesn't work??


I press home, of course. At least sites can't break that button.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: