Take the 2-minute tour ×

In the current HTML5 specification, one can POST a form to an action with the data scheme:


It basically embeds the form data into a placeholder of the action attribute and navigates to the resulting data: url.

In the form submission algorithm described by the specification linked above, it is step 17.

I understand how the algorithm works. I wonder, though, whether there are any use cases for this facility in web applications. Are there any meaningful resources one can create this way (and for which there is no easier way to accomplish them)?

share|improve this question
Possibly relevant to your question here, from a design level: stackoverflow.com/questions/597596/…. –  MrGomez Apr 10 '12 at 21:46
Could you clarify exactly which step you're asking about? –  jandjorgensen Apr 11 '12 at 0:23
@MrGomez: The question you pointed at was for (emulating) nested forms. As HTML5 has the concept of a form owner for input elements, that issue can be solved in a canonical way without any "data: url"s as the action attribute. Actually I don't see how such a "data:" action could help in that scenario. –  Marc Apr 11 '12 at 6:23
@jandjorgensen: I have added a bit to my question. Does it help you? –  Marc Apr 11 '12 at 6:29
I'm still not entirely sure what the question is, but it isn't necessarily the way you asked--I may just not be doing a good job of figuring it out. Is it that you're curious about why a certain piece of the specification exists? –  jandjorgensen Apr 13 '12 at 19:22
show 3 more comments

2 Answers

up vote 3 down vote accepted

This feature enables debugging how a browser treats a form without using a server. I think it would be particularly interesting if I were having difficulty with the encoding of a given form. Replacing an actual application URL with a data URI would allow you to see the form content that would be transmitted via POST.

That said, I wonder if this feature is implemented anywhere.

As for use in applications, there are more flexible ways to generate a data URL. It could be convenient if one had a page that was going to extract the substituted form data, parse it, and do something with it, but the extra level of indirection in the data URI seems unnecessary.

share|improve this answer
This post from the WHAT-WG mailing list supports @ellisbben's assertion it is really only for debugging: lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2006-August/… –  Mike McCaughan Apr 16 '12 at 19:30
add comment

I've seen this used in HTML5 drawing applications. Harmony by Mr. Doob is a great example: http://mrdoob.com/projects/harmony/

You hit save, and you're taken to a data:url that is your image rendered as a png from that url.

share|improve this answer
I have checked the source code of Harmony. It is using the "toDataURL" method of an HTML canvas to create the data: uri that represents the image in PNG format. It is not using the mechanism of form submission to a data uri:. As this mechanism is just simple substitution, I don't see how meaningful images can be created by it. –  Marc Apr 16 '12 at 8:12
Sorry for leading you down a path of malcontent and error. –  EvilJordan Apr 17 '12 at 19:04
add comment

Your Answer


