2

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

http://www.w3.org/TR/2011/WD-html5-20110525/association-of-controls-and-forms.html#form-submission-algorithm

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)?

8
  • Possibly relevant to your question here, from a design level: stackoverflow.com/questions/597596/….
    – MrGomez
    Apr 10, 2012 at 21:46
  • Could you clarify exactly which step you're asking about?
    – ramblinjan
    Apr 11, 2012 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, 2012 at 6:23
  • @jandjorgensen: I have added a bit to my question. Does it help you?
    – Marc
    Apr 11, 2012 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?
    – ramblinjan
    Apr 13, 2012 at 19:22

2 Answers 2

3
+100

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.

2
-1

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.

1
  • 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, 2012 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.