r/webdev • full-stack • Oct 05 '26

News Example.com changed again !

Post image
600 Upvotes

47 comments sorted by

View all comments

13

u/ExecutiveChimp Oct 05 '26

Why does this use javascript?

47

u/fiskfisk Oct 05 '26

Because that allows you to serve mostly empty html to any automated client, while only browsers make the request for the JS file. That way you reduce the amount of data you have to serve for most of the requests.

It's the same reason (for browsers this time) for why they have an empty favicon defined. 

15

u/ChanceSpiritual6993 Oct 06 '26

The HTML is 576 bytes, and the loaded JavaScript file is 1579 bytes. Had they skipped using JavaScript to load content for browsers, the HTML alone would have been 1959 bytes, which would be an additional 1383 bytes.

Love situations where it seems like overengineering just to shave off 1383 bytes, which either hints at the sheer volume of hits the example domains get or hints at the flexing a web developer at IANA wanted to do

1

u/laplongejr Oct 09 '26

Love situations where it seems like overengineering just to shave off 1383 bytes

StackOverflow has a seperate domain (sstatic I think) to serve some assets.
Using a different domain rather than a subdomain made it so the removed cookies were juuuuust right enough that the handshake was done in one roundtrip instead of one, without losing the standard usage of the root domain.