发布到数据:url - 是否有任何用例? [英] Post to data: url — Are there any use cases?

查看:132
本文介绍了发布到数据:url - 是否有任何用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在当前的HTML5规范中,可以使用数据方案将 POST 表单转换为一个操作:

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

它基本上将表单数据嵌入到action属性的占位符中,然后导航到结果数据:url。



在上面链接的规范描述的表单提交算法中,它是第17步。该算法起作用。不过,我想知道,在Web应用程序中是否有这种设施的用例。是否有任何有意义的资源可以用这种方式创建(并且没有更简单的方法来完成它们)?

功能可以调试浏览器如何在不使用服务器的情况下处理表单。如果我在编码给定表单时遇到困难,我认为这会特别有趣。使用数据URI替换实际的应用程序URL将允许您查看将通过 POST 传输的表单内容。



<这就是说,我想知道这个功能是否在任何地方实现。



至于在应用程序中的使用,有更灵活的方法来生成数据URL。如果有一个页面将提取替换后的表单数据,解析它并对其执行某些操作,但数据URI中额外的间接级别似乎没有必要,这可能会很方便。


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

解决方案

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.

这篇关于发布到数据:url - 是否有任何用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆