html 中隐藏输入的长度是否有最大大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1752768/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:21:23  来源:igfitidea点击:

is there a max size to the length of a hidden input in html?

htmlinput

提问by sprugman

in other words:

换句话说:

<input type="hidden" value="Can I put as much as I want in here, or is there a limit?" />

and if so, what is it?

如果是,那是什么?

采纳答案by Pekka

It depends on the method you send the form with.

这取决于您发送表单的方法。

With GET, there is a commonly agreed on limit of about 1-2 kilobytes, depending on browser and server limitations.

对于 GET,根据浏览器和服务器的限制,有一个普遍同意的大约 1-2 KB 的限制。

With POST, there is no technical limit in the browser, but usually one on the server side - see e.g. Apache's LimitRequestBody, PHP's post_max_sizeand so on.

使用 POST,浏览器没有技术限制,但通常在服务器端有一个限制 - 参见例如 Apache LimitRequestBody、PHPpost_max_size等。

回答by naugtur

Warning! I have experienced problems with <input type="text">when text is longer than 65535 (max signed int size)

警告!<input type="text">当文本长度超过 65535(最大有符号整数大小)时,我遇到了问题

Pasting the text seems to cause some weird overflow of content. Spotted in webkit.

粘贴文本似乎会导致一些奇怪的内容溢出。在 webkit 中发现。

[edit]

[编辑]

The size of GET request is not exactly limited the way Pekka wrote. There is a limit of 2083 bytes for the whole GET query string address?paramsin Internet Explorer onlyIn other browsers there is practically no limit, with FireFox sending GET queries of over 100KB for example. Obviously the server has to allow those.

GET 请求的大小并不像 Pekka 所写的那样完全受到限制。有2083个字节为全GET查询字符串的限制address?paramsInternet Explorer中仅在其他浏览器中几乎没有任何限制,在FireFox超过100KB发送的GET查询为例。显然,服务器必须允许这些。

It's not covered in documentation, so one has to test it to know the limits for other browsers. IE: http://support.microsoft.com/kb/208427

它没有包含在文档中,因此必须对其进行测试以了解其他浏览器的限制。IE:http: //support.microsoft.com/kb/208427