Base64-encoded images as CSS backgrounds in UIWebViews

I love that you can embed Base64-encoded images in CSS and that WebKit understands them.

Here, for example, is a way to add my Open in External App icon to links that you capture from a UIWebView to display in Mobile Safari:

a {
  color:rgb(50, 79, 133);
  text-decoration:none;
  padding-left:26px;
  background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAARCAYAAADDjbwNAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKZJREFUeNpi+v//PwM9MBMDncDws4jFOKBNF0hfIkGPydkNVWfJ8dEcEvXMIctHQKwOZTMSof4/EOuSaxE/CerBjgEGN9xiYDAywvhANt6g+09JJAMt+Y/PAmSLPhERXLgw0ZZRLXmDLCNkER81LALFFaU+YsSD4ZYgJRDaBB0xlsCS9ycSkvh/tGBiJJSskX10k4jUhZzKLpBbqKaTqCeFHIsAAgwAk2iI07NfUtQAAAAASUVORK5CYII=);
  background-repeat:no-repeat;
}

Comments