Maybe it worths adding a side note on why we can't do that server-side (re API to serve appropriate content types); and using data-uris for that purpose?