gpt4 book ai didi

html - 浏览器是否保留 GET/POST 上具有相同名称的输入顺序?

转载 作者:技术小花猫 更新时间:2023-10-29 11:44:34 25 4
gpt4 key购买 nike

我的 HTML 代码包含多个同名的 input:

<input type="hidden" value="42" name="authors" />
<input type="hidden" value="13" name="authors" />
<input type="hidden" value="33" name="authors" />

值的顺序很重要。 HTML 规范是否定义用户代理必须保留此顺序,如果是,常见(市场份额 > 1%)浏览器是否遵循此定义?

如果有人知道 WSGI,尤其是 Django 是否保留服务器端的顺序,则加分 :-)

谢谢!

最佳答案

是的,它们应该按照 html rfc 出现的顺序发送

参见 8.2.1。形式 urlencoded 媒体类型:

The fields are listed in the order they appear in the document with the name separated from the value by = and the pairs separated from each other by &. Fields with null values may be omitted. In particular, unselected radio buttons and checkboxes should not appear in the encoded data, but hidden fields with VALUE attributes present should.

我在规范中找到了 html 4.0也是:

对于 url 编码的数据:

The control names/values are listed in the order they appear in the document. The name is separated from the value by = and name/value pairs are separated from each other by &.

对于多部分数据(感谢@Chuck):

A "multipart/form-data" message contains a series of parts, each representing a successful control. The parts are sent to the processing agent in the same order the corresponding controls appear in the document stream. Part boundaries should not occur in any of the data; how this is done lies outside the scope of this specification.

关于html - 浏览器是否保留 GET/POST 上具有相同名称的输入顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4027635/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com