Jay McGavren's Journal

How a Head First author spends his days off

View on GitHub
2012-08-31

SVG in a URL!

Some folks were messing around with a “data:text/html” URL in Campfire (paste it into your address bar to render the accompanying HTML), which I hadn’t known was possible… Well, of course I immediately had to see if other MIME types would work, and the first thing I tried was SVG…

Raw form (copy-paste in your address bar):

data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><g transform="rotate(50),scale(9)"><text>SVG in a URL!</text></g></svg>

Link form (uses entities for the angle brackets):

SVG in a URL!

Tested in Chrome, Safari and Firefox on OSX. If it doesn’t work for you (or is expected to be deprecated in the future), I’d be curious to know.

Copyright © Jay McGavren.