Hacker News new | ask | show | jobs
by Scarbutt 1736 days ago
For example, Ikea for product lists sends mini chunks of simple HTML. No JS involved.

Can you elaborate how? like some turbolinks thing?

2 comments

The back-end can render that content when requested, adding very little overhead to an AJAX request just returning the raw data, and it can pre-render and/or cache objects as well. Both Facebook and Reddit do similar when loading extra content into an existing page - they embed HTML content in the JSON response for things like profile popovers or when loading more comments. Saves the front-end from having to render a template (takes time to load the template beforehand and time to render it, maybe for many items) or build it programmatically. Directly using AJHX to get HTML is the same when there's just a chunk of HTML with no metadata.
I don't work for Ikea so I don't know how it is implemented.

What you can see in the Network tab is that you get chunks of html from the backend which have all the markup

Other e-commerce stores do that too.

Sometimes these chunks also have js in them.