Hacker News new | ask | show | jobs
by helenius 3052 days ago
Maybe somewhat related: can anybody guess what the idea behind the images in this article is?

  <img src="/images/trans.gif" data-src="images/speaking.png">
trans.gif is just a 1x1px invisible pixel.
2 comments

It's lazy loading the images - when the page initially loads, it only loads one small image (trans.gif), and the file specified in the data-src attribute isn't loaded until you scroll near to the img tag. Specifically, it's using this plugin: http://luis-almeida.github.io/unveil/
The given use of that on frankchimero.com is bad.

If I use uMatrix then even enabling scripts for the site won't show the images.

Moreover, if the javascript is turned off completely, the proper approach for the given task is having the

    <noscript
and the images properly specified.

One of the images is just a PNG of an emoji U+1F632 (my guess). Another of the emoji of the cake. He could have saved on these two completely.

That leaves us with the tile svg and the 170K PNG for the face of the author, which should obviously be a 40K JPG.

Finally, the img tags on that page don't contain dimensions, whereas it's probably(1) better to still have them: https://www.computerhope.com/issues/ch001158.htm

Given the topic of the post (the need to keep things simple when making web pages), I consider these observations relevant.

1) Probably as I'm not in the business and I don't follow most recent developments so I don't know if the arguments from computerhope.com are obsolete by the most recent standards or implementations, so all relevant technical information is welcome.

I kind of wish more sites assigned dimensions to `img` tags too. Unspecified or scripted dimensions make mess more often than not.
Tracking scripts don't need to do anything but read the hit in the access log. That said, it's also trivially easy to output the bytes for a 1x1 invisible gif as the response from your tracking endpoint.
It is easy, but is it fast? Serving a static GIF has an overhead of ~0, and it doesn't need any executable beyond the HTTP server to run on the machine, except to move the logs out for processing (syslog, rsync, what-have-you, in most cases out-of-band wrt the HTTP server).