I am making a website that displays a lot of small icons (stars, flags, folders ...)
Now I am using CSS sprite technique and it works great, but hard to work.
I am thinking of creating a large .js file with all images encoded as javascript variables. Then display the images as follows:
images.js
var myimage1 = 'data:image/png;base64,iVBORw0KGgoAAAANS...'; var myimage2 = 'data:image/png;base64,cB324CD64aB3Cme23...';
html code
<script type=text/javascript src=images.js></script> .... <img src="javascript:myimage1"> <img src="javascript:myimage2">
I know that the .js file will be larger, but it is very easy to maintain and it will be cached by the browser.
Is this a good or bad idea? Is this cross browser?
Peter source share