<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: data-urls</title><link href="http://feeds.simonwillison.net/" rel="alternate"/><link href="http://feeds.simonwillison.net/tags/data-urls.atom" rel="self"/><id>http://feeds.simonwillison.net/</id><updated>2026-07-04T23:09:02+00:00</updated><author><name>Simon Willison</name></author><entry><title>Building a World Map with only 500 bytes</title><link href="https://simonwillison.net/2026/Jul/4/building-a-world-map-with-only-500-bytes/#atom-tag" rel="alternate"/><published>2026-07-04T23:09:02+00:00</published><updated>2026-07-04T23:09:02+00:00</updated><id>https://simonwillison.net/2026/Jul/4/building-a-world-map-with-only-500-bytes/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.experimentlog.com/blog/building-a-world-map-with-only-500-bytes"&gt;Building a World Map with only 500 bytes&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Iwo Kadziela (assisted by Codex) figured out a way to generate a credible ASCII world map using 445 bytes of data:&lt;/p&gt;
&lt;p&gt;&lt;img alt="A map of the world rendered as black asterisk ASCII characters, it looks very good" src="https://static.simonwillison.net/static/2026/world-map-ascii.png" /&gt;&lt;/p&gt;
&lt;p&gt;The key trick is to use deflate compression, which is then wired together using this neat snippet of JavaScript. I didn't know you could use &lt;code&gt;fetch()&lt;/code&gt; with &lt;code&gt;data:&lt;/code&gt; URIs like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fetch('data:;base64,1ZpLsgIxCEXnrM...==').then(
  r =&amp;gt; r.body.pipeThrough(new DecompressionStream('deflate-raw'))
).then(
  s =&amp;gt; new Response(s).text()
).then(
  t =&amp;gt; b.innerHTML = '&amp;lt;pre style=font-size:.65vw&amp;gt;' + t
)
&lt;/code&gt;&lt;/pre&gt;

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://news.ycombinator.com/item?id=48747762"&gt;Hacker News&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/ascii-art"&gt;ascii-art&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;&lt;/p&gt;



</summary><category term="ascii-art"/><category term="data-urls"/><category term="javascript"/></entry><entry><title>image-to-jpeg</title><link href="https://simonwillison.net/2023/Apr/5/image-to-jpeg/#atom-tag" rel="alternate"/><published>2023-04-05T22:10:17+00:00</published><updated>2023-04-05T22:10:17+00:00</updated><id>https://simonwillison.net/2023/Apr/5/image-to-jpeg/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://tools.simonwillison.net/image-to-jpeg"&gt;image-to-jpeg&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
I built a little JavaScript app that accepts an image, then displays that image as a JPEG with a slider to control the quality setting, plus a copy and paste textarea to copy out that image with a data-uri. I didn't actually write a single line of code for this: I got ChatGPT/GPT-4 to generate the entire thing with some prompts.&lt;/p&gt;
&lt;p&gt;Here's &lt;a href="https://gist.github.com/simonw/66918b6cde1f87bf4fc883c67735195d"&gt;the full transcript&lt;/a&gt;.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://gist.github.com/simonw/66918b6cde1f87bf4fc883c67735195d"&gt;Drag-Drop Image Conversion&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/projects"&gt;projects&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/tools"&gt;tools&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ai"&gt;ai&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/generative-ai"&gt;generative-ai&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/chatgpt"&gt;chatgpt&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/llms"&gt;llms&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ai-assisted-programming"&gt;ai-assisted-programming&lt;/a&gt;&lt;/p&gt;



</summary><category term="data-urls"/><category term="projects"/><category term="tools"/><category term="ai"/><category term="generative-ai"/><category term="chatgpt"/><category term="llms"/><category term="ai-assisted-programming"/></entry><entry><title>The Page With No Code</title><link href="https://simonwillison.net/2023/Jan/21/the-page-with-no-code/#atom-tag" rel="alternate"/><published>2023-01-21T18:59:56+00:00</published><updated>2023-01-21T18:59:56+00:00</updated><id>https://simonwillison.net/2023/Jan/21/the-page-with-no-code/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://danq.me/2023/01/11/nocode/"&gt;The Page With No Code&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
A fun demo by Dan Q, who created a web page with no HTML at all - but in Firefox it still renders content, thanks to a data URI base64 encoded stylesheet served in a &lt;code&gt;link:&lt;/code&gt; header that uses &lt;code&gt;html::before&lt;/code&gt;, &lt;code&gt;html::after&lt;/code&gt;, &lt;code&gt;body::before&lt;/code&gt; and &lt;code&gt;body::after&lt;/code&gt; with &lt;code&gt;content:&lt;/code&gt; properties to serve the content. It even has a background image, encoded as a base64 SVG nested inside another data URI.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://gist.github.com/simonw/1fc19bf4afceb5192d7670ee05162fab"&gt;I decoded it in this Gist&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/css"&gt;css&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/html"&gt;html&lt;/a&gt;&lt;/p&gt;



</summary><category term="css"/><category term="data-urls"/><category term="html"/></entry><entry><title>Animating a commit based Sudoku game using Puppeteer</title><link href="https://simonwillison.net/2020/Oct/9/animating-using-puppeteer/#atom-tag" rel="alternate"/><published>2020-10-09T22:28:53+00:00</published><updated>2020-10-09T22:28:53+00:00</updated><id>https://simonwillison.net/2020/Oct/9/animating-using-puppeteer/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/anishkny/animating-a-commit-based-sudoku-game-using-puppeteer-185f"&gt;Animating a commit based Sudoku game using Puppeteer&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
This is really clever. There’s a GitHub repo that tracks progress in a game of Sudoku: Anish Karandikar wrote code which iterates through the game board state commit by commit, uses that state to generate an HTML table, passes that table to Puppeteer using a data: URI, renders a PNG of each stage and then concatenates those PNGs together into an animated GIF using the gifencoder Node.js library.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://twitter.com/anishkny/status/1314692705969008640"&gt;@anishkny&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/gifs"&gt;gifs&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/puppeteer"&gt;puppeteer&lt;/a&gt;&lt;/p&gt;



</summary><category term="data-urls"/><category term="gifs"/><category term="puppeteer"/></entry><entry><title>pdf.js</title><link href="https://simonwillison.net/2010/Jun/17/pdfjs/#atom-tag" rel="alternate"/><published>2010-06-17T19:39:00+00:00</published><updated>2010-06-17T19:39:00+00:00</updated><id>https://simonwillison.net/2010/Jun/17/pdfjs/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.maraksquires.com/pdf.js/"&gt;pdf.js&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
A JavaScript library for creating simple PDF files. Works (flakily) in your browser using a data:URI hack, but is also compatible with server-side JavaScript implementations such as Node.js.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/nodejs"&gt;nodejs&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/pdf"&gt;pdf&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/recovered"&gt;recovered&lt;/a&gt;&lt;/p&gt;



</summary><category term="data-urls"/><category term="javascript"/><category term="nodejs"/><category term="pdf"/><category term="recovered"/></entry><entry><title>Smokescreen demo: a Flash player in JavaScript</title><link href="https://simonwillison.net/2010/May/29/smokescreen/#atom-tag" rel="alternate"/><published>2010-05-29T11:32:00+00:00</published><updated>2010-05-29T11:32:00+00:00</updated><id>https://simonwillison.net/2010/May/29/smokescreen/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://smokescreen.us/demos/sb45demo.html"&gt;Smokescreen demo: a Flash player in JavaScript&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Chris Smoak’s Smokescreen, “a Flash player written in JavaScript”, is an incredible piece of work. It runs entirely in the browser, reads in SWF binaries, unzips them (in native JS), extracts images and embedded audio and turns them in to base64 encoded data:uris, then stitches the vector graphics back together as animated SVG.&lt;/p&gt;
&lt;p&gt;Open up the Chrome Web Inspector while the demo is running and you can see the SVG changing in real time. Smokescreen even implements its own ActionScript bytecode interpreter!&lt;/p&gt;
&lt;p&gt;It’s stated intention is to allow Flash banner ads to execute on the iPad and iPhone, but there are plenty of other interesting applications (such as news site infographics).&lt;/p&gt;
&lt;p&gt;The company behind it have announced plans to open source it in the near future. My one concern is performance—the library is 175 KB and over 8,000 lines of JavaScript which might cause problems on low powered mobile devices.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/flash"&gt;flash&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/svg"&gt;svg&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/recovered"&gt;recovered&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/chris-smoak"&gt;chris-smoak&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/smokescreen"&gt;smokescreen&lt;/a&gt;&lt;/p&gt;



</summary><category term="data-urls"/><category term="flash"/><category term="javascript"/><category term="svg"/><category term="recovered"/><category term="chris-smoak"/><category term="smokescreen"/></entry><entry><title>SPDY: The Web, Only Faster</title><link href="https://simonwillison.net/2009/Nov/13/spdy/#atom-tag" rel="alternate"/><published>2009-11-13T13:00:08+00:00</published><updated>2009-11-13T13:00:08+00:00</updated><id>https://simonwillison.net/2009/Nov/13/spdy/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://alex.dojotoolkit.org/2009/11/spdy-the-web-only-faster/"&gt;SPDY: The Web, Only Faster&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Alex Russell explains the benefits of Google’s SPDF proposal (a protocol that upgrades HTTP)—including header compression, multiplexing, the ability to send additional resources such as images and stylesheets down without needing the data:uri hack and Comet support built in to the core assumptions of the protocol.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/alex-russell"&gt;alex-russell&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/comet"&gt;comet&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/compression"&gt;compression&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/google"&gt;google&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/http"&gt;http&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/spdy"&gt;spdy&lt;/a&gt;&lt;/p&gt;



</summary><category term="alex-russell"/><category term="comet"/><category term="compression"/><category term="data-urls"/><category term="google"/><category term="http"/><category term="spdy"/></entry><entry><title>Quoting Fredrik Lundh</title><link href="https://simonwillison.net/2007/Aug/7/data/#atom-tag" rel="alternate"/><published>2007-08-07T10:52:19+00:00</published><updated>2007-08-07T10:52:19+00:00</updated><id>https://simonwillison.net/2007/Aug/7/data/#atom-tag</id><summary type="html">
    &lt;blockquote cite="http://effbot.org/zone/zone-django-notes.htm"&gt;&lt;p&gt;Inline images are stored as data URI:s in the intermediate format (and usually also in the source documents), but since not all browsers support this format, the renderer replaces the data URI:s with HTTP pointers to an image cache directory.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p class="cite"&gt;&amp;mdash; &lt;a href="http://effbot.org/zone/zone-django-notes.htm"&gt;Fredrik Lundh&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/django"&gt;django&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/fredrik-lundh"&gt;fredrik-lundh&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/http"&gt;http&lt;/a&gt;&lt;/p&gt;



</summary><category term="data-urls"/><category term="django"/><category term="fredrik-lundh"/><category term="http"/></entry><entry><title>Microformats Bookmarklet</title><link href="https://simonwillison.net/2007/Feb/27/microformats/#atom-tag" rel="alternate"/><published>2007-02-27T23:43:26+00:00</published><updated>2007-02-27T23:43:26+00:00</updated><id>https://simonwillison.net/2007/Feb/27/microformats/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://leftlogic.com/info/articles/microformats_bookmarklet"&gt;Microformats Bookmarklet&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Microformats bookmarklet, targetted at Safari. Uses jQuery CSS selectors for parsing, and generates .vcf vCard files using data: uris.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/bookmarklets"&gt;bookmarklets&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jquery"&gt;jquery&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/microformats"&gt;microformats&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/safari"&gt;safari&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/vcard"&gt;vcard&lt;/a&gt;&lt;/p&gt;



</summary><category term="bookmarklets"/><category term="data-urls"/><category term="jquery"/><category term="microformats"/><category term="safari"/><category term="vcard"/></entry><entry><title>Bumpspark Library-less Minigraphs</title><link href="https://simonwillison.net/2005/Apr/28/bumpspark/#atom-tag" rel="alternate"/><published>2005-04-28T22:19:17+00:00</published><updated>2005-04-28T22:19:17+00:00</updated><id>https://simonwillison.net/2005/Apr/28/bumpspark/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.whytheluckystiff.net/bumpspark/"&gt;Bumpspark Library-less Minigraphs&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
It’s that neat data:uri hack but for Ruby and without needing an external image library.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="http://redhanded.hobix.com/inspect/sparklinesForMinimalists.html"&gt;RedHanded&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;&lt;/p&gt;



</summary><category term="data-urls"/></entry><entry><title>Self-contained data: URI kitchen</title><link href="https://simonwillison.net/2003/Aug/11/selfContained/#atom-tag" rel="alternate"/><published>2003-08-11T16:53:36+00:00</published><updated>2003-08-11T16:53:36+00:00</updated><id>https://simonwillison.net/2003/Aug/11/selfContained/#atom-tag</id><summary type="html">
    &lt;p&gt;I couldn't resist this. Hixie has &lt;a href="http://ln.hixie.ch/?start=1060613891&amp;amp;count=1" title="I still love data: URLs"&gt;released&lt;/a&gt; a new version of his &lt;a href="http://software.hixie.ch/utilities/cgi/data/data"&gt;data: URI kitchen&lt;/a&gt;, to celebrate the addition of data: URI support to the latest Opera beta. In the spirit of recursion, I present this reformulation of the data: URI kitchen that uses client side Javascript. What better way to deliver such a thing than as a data URI?&lt;/p&gt;

&lt;p&gt;&lt;a href="data:text/html;charset=utf-8,%3C!DOCTYPE%20HTML%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20HTML%204.0%2F%2FEN%22%3E%0D%0A%3Chtml%20lang%3D%22en%22%3E%0D%0A%3Chead%3E%0D%0A%3Ctitle%3EThe%20data%3A%20URI%20kitchen%20as%20a%20data%3A%20URI%3C%2Ftitle%3E%0D%0A%3Cstyle%20type%3D%22text%2Fcss%22%3E%0D%0A%3C%2Fstyle%3E%0D%0A%3Cscript%20type%3D%22text%2Fjavascript%22%3E%0D%0Avar%20base64EncodeChars%20%3D%20%22ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%2B%2F%22%3B%0D%0A%0D%0Afunction%20base64encode(str)%20%7B%0D%0A%20%20%20%20var%20out%3B%20var%20i%3B%20var%20len%3B%0D%0A%20%20%20%20var%20c1%3B%20var%20c2%3B%20var%20c3%3B%0D%0A%20%20%20%20var%20len%20%3D%20str.length%3B%0D%0A%20%20%20%20var%20i%20%3D%200%3B%0D%0A%20%20%20%20out%20%3D%20%22%22%3B%0D%0A%20%20%20%20while(i%20%3C%20len)%20%7B%0D%0A%20%20%20%20%20%20%20%20c1%20%3D%20str.charCodeAt(i%2B%2B)%20%26%200xff%3B%0D%0A%20%20%20%20%20%20%20%20if(i%20%3D%3D%20len)%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt(c1%20%3E%3E%202)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt((c1%20%26%200x3)%20%3C%3C%204)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20out%20%2B%3D%20%22%3D%3D%22%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20c2%20%3D%20str.charCodeAt(i%2B%2B)%3B%0D%0A%20%20%20%20%20%20%20%20if(i%20%3D%3D%20len)%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt(c1%20%3E%3E%202)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt(((c1%20%26%200x3)%20%3C%3C%204)%20%7C%20((c2%20%26%200xF0)%20%3E%3E%204))%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt((c2%20%26%200xF)%20%3C%3C%202)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20out%20%2B%3D%20%22%3D%22%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20c3%20%3D%20str.charCodeAt(i%2B%2B)%3B%0D%0A%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt(c1%20%3E%3E%202)%3B%0D%0A%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt(((c1%20%26%200x3)%20%3C%3C%204)%20%7C%20((c2%20%26%200xF0)%20%3E%3E%204))%3B%0D%0A%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt(((c2%20%26%200xF)%20%3C%3C%202)%20%7C%20((c3%20%26%200xC0)%20%3E%3E%206))%3B%0D%0A%20%20%20%20%20%20%20%20out%20%2B%3D%20base64EncodeChars.charAt(c3%20%26%200x3F)%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20return%20out%3B%0D%0A%7D%0D%0A%0D%0Afunction%20generate()%20%7B%0D%0A%20%20%20%20var%20content%20%3D%20document.data.content.value%3B%0D%0A%20%20%20%20var%20uri%20%3D%20&amp;apos;data%3A&amp;apos;%2Bdocument.data.type.value%3B%0D%0A%20%20%20%20if%20(document.data.base64.checked)%20%7B%0D%0A%20%20%20%20%20%20%20%20content%20%3D%20base64encode(content)%3B%0D%0A%20%20%20%20%20%20%20%20uri%20%2B%3D%20&amp;apos;%3Bbase64&amp;apos;%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20uri%20%2B%3D%20&amp;apos;%2C&amp;apos;%20%2B%20escape(content)%3B%0D%0A%20%20%20%20document.getElementById(&amp;apos;uri&amp;apos;).href%20%3D%20uri%3B%0D%0A%20%20%20%20document.getElementById(&amp;apos;uri&amp;apos;).style.display%20%3D%20&amp;apos;inline&amp;apos;%3B%0D%0A%7D%0D%0A%3C%2Fscript%3E%0D%0A%3C%2Fhead%3E%0D%0A%3Cbody%3E%0D%0A%3Cform%20name%3D%22data%22%20method%3D%22get%22%3E%0D%0A%3Cp%3EType%3A%0D%0A%3Cinput%20type%3D%22text%22%20name%3D%22type%22%20value%3D%22text%2Fhtml%3Bcharset%3Dutf-8%22%3E%0D%0A%3Clabel%3E%3Cinput%20type%3D%22checkbox%22%20name%3D%22base64%22%20value%3D%221%22%3E%20base64%20%3C%2Flabel%3E%3C%2Fp%3E%0D%0A%3Ctextarea%20rows%3D%2212%22%20cols%3D%2280%22%20name%3D%22content%22%3E%3C%2Ftextarea%3E%0D%0A%3Cp%3E%3Cinput%20type%3D%22submit%22%20value%3D%22Generate%22%20onclick%3D%22generate()%3B%20return%20false%3B%22%3E%3C%2Fp%3E%0D%0A%3Cp%3E%3Ca%20id%3D%22uri%22%20href%3D%22about%3Anone%22%20style%3D%22display%3A%20none%3B%22%3EThe%20URI%3C%2Fa%3E%3C%2Fp%3E%0D%0A%3C%2Fform%3E%0D%0A%3C%2Fbody%3E%0D%0A%3C%2Fhtml%3E"&gt;Self contained data: URI kitchen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update (12th August 10:40am)&lt;/strong&gt;: I've changed the above to take in to account a bug report from Hixie in the comments.&lt;/p&gt;
    
        &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/data-urls"&gt;data-urls&lt;/a&gt;&lt;/p&gt;
    

</summary><category term="data-urls"/></entry></feed>