When to use Data URI’s

By Geoff Muskett

So data URI’s are pretty smart, basically it’s all the data of an image embedded in a page (or stylesheet) so the browser doesn’t have to make another request to the server. Which is almost always a good thing. More info over on Treehouse blog…

Buuuut, what about caching?

To my mind the best use case for data URI’s is one off images. Something thats not going to be used elsewhere on the site. Or at least not likely to be.

I suppose if you set proper caching on HTML and CSS then this may not be an issue. However embedding makes the image one third heavier than a png (although I can’t find any proper studies on that).

They’re possibly not that great on mobile, either. But that is something that will rapidly improve I’m sure.

There’s definitely a place for using data URI’s in websites, not for all images, but weighing up the pro’s and cons for each use-case will certainly fall in favour of pro’s in some cases.

Comments

Leave a Reply

Your email address will not be published.

Join my newsletter

If you’re looking for insights into web design and development, and crafting a successful presence online, then you should join the smart folk on on my newsletter. I discuss my thoughts on an issue relating to the web, then provide and teach effective solutions.