Chrome Adds Support for “srcset” Attribute for Intelligent Image Serving

Among a couple of other things, the recent Beta channel update for Chrome added support for srcset attribute so that developers can serve images better, according to the capability of the device which is accessing the content.

From the official description:

The srcset attribute allows authors to provide a set of images to handle graphical displays of varying dimensions and pixel densities.

The attribute essentially takes a comma-separated list of URLs each with one or more descriptors giving the maximum viewport dimensions and pixel density allowed to use the image. From the available options, the user agent then picks the most appropriate image. If the viewport dimensions or pixel density changes, the user agent can replace the image data with a new image on the fly.

For developers who are interested, Google has provided instructions and sample code here.

Leave a Reply

Your email address will not be published.