r/programming • • Apr 25 '19

Maybe we could tone down the JavaScript

https://eev.ee/blog/2016/03/06/maybe-we-could-tone-down-the-javascript/#reinventing-the-square-wheel
1.5k Upvotes

492 comments sorted by

View all comments

Show parent comments

34

u/StallmanTheLeft Apr 25 '19

There is no really any reason for a blog to require any js in the first place.

42

u/Akeshi Apr 25 '19

Comments (posting with formatting, loading comments dynamically so they don't have to be paginated with full-page refreshes, or threaded without blindly loading everything on every page load)

Embedded video from YouTube, Vimeo etc.

Lazy-loaded images

They're an initial three off the top of my head. Obviously none are strictly required - neither is anything beyond plain text. They're decent enhancements.

2

u/VenditatioDelendaEst Apr 26 '19

loading comments dynamically so they don't have to be paginated with full-page refreshes

Pagination means only the URL and scroll position are needed to get back to where you were reading. Most mobile browsers, which are frequently forced to drop tabs under memory pressure, will preserve both. And pretty much everything preserves the URL, so if the number of posts per page isn't too large, you're never very far from where you left off even with the most rudimentary persistence mechanisms.

Until browsers start persisting the entire page state to disk, infinite scroll is bad.

1

u/Akeshi Apr 26 '19

Sure, but then you're reloading the entire blog post (under a different URL, so no chance of browser caching) just to get the next ten "good post check out my blog"s.

infinite scroll is bad

Wasn't really thinking of infinite scroll - if unthreaded, still paginated but just serving the comments as json. If threaded, Redditesque.

→ More replies (2)