html文本框的最大长度是多少?

时间:2020-12-09 22:18:41

can anyone help me with the length of maximum characters that can be contain in a normal HTML text box....

任何人都可以帮助我在普通的HTML文本框中包含的最大字符长度....

3 个解决方案

#1


22  

As to the HTML side, when the maxlength attribute is not specified, then the maximum length of the input value is unlimited. However, if you're sending the request as GET instead of POST, then the limit will depend on the webbrowser and webserver used. The HTTP 1.1 specification even warns about this, here's an extract of chapter 3.2.1:

对于HTML方面,当未指定maxlength属性时,输入值的最大长度不受限制。但是,如果您将请求作为GET而不是POST发送,则限制将取决于所使用的Web浏览器和Web服务器。 HTTP 1.1规范甚至警告过这一点,这是第3.2.1章的摘录:

Note: Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.

注意:服务器应该谨慎依赖于长度超过255个字节的URI,因为某些较旧的客户端或代理实现可能无法正确支持这些长度。

As to the webbrowsers, the practical limit is in Firefox about 8KB, in Opera about 4KB and in IE and Safari about 2KB. So the total length of all inputs should not exceed this if you want a succesful processing. As to the webservers, most have a configureable limit of 8KB. When the limit is exceeded, then it will often just be truncated, but some webservers may send a HTTP 414 error.

对于webbrowsers,实际限制在Firefox中约为8KB,在Opera中约为4KB,在IE和Safari中约为2KB。因此,如果您想要成功处理,所有输入的总长度不应超过此值。对于Web服务器,大多数都具有8KB的可配置限制。超过限制时,通常只会被截断,但某些Web服务器可能会发送HTTP 414错误。

When you're sending the request as POST, then the limit depends on the server config. Often it's around 2GB. When it's exceeded, the server will often return a HTTP 500 error.

当您以POST发送请求时,限制取决于服务器配置。通常它大约2GB。超过时,服务器通常会返回HTTP 500错误。

#2


4  

Default maxlength is unlimited for a <input type='text'/>. You may optionally provide this value to constrain input (but there's no guarentees the browser will inforce the rule).

对于,默认maxlength是无限的。您可以选择提供此值来约束输入(但是浏览器不会强制执行规则)。

A <textarea> does not support a maxlength so unlimited characters are accepted for input.

(ref: http://www.w3.org/MarkUp/HTMLPlus/htmlplus_41.html)

(参考:http://www.w3.org/MarkUp/HTMLPlus/htmlplus_41.html)

RE: Long string breaking during submit

RE:提交期间长字符串断开

There can be a maximum size to the amount of date submitted from a form when using the method get (the default if not specified). It's only a can because many browsers allow many more characters now. If you use a form with the post method, there is no maximum to the amount of data submitted.

使用方法get时,从表单提交的日期数量可以有最大大小(如果未指定,则为默认值)。它只是一个罐头,因为许多浏览器现在允许更多的字符。如果您使用带有post方法的表单,则提交的数据量没有最大值。

#3


1  

In HTML4, the maxlength attribute is only supported on the input element. HTML5 extends this to allow it on textarea as well. A quick test works in Firefox 4 and WebKit, but not Firefox 3 or Opera. If you need support for HTML4, use JavaScript to manually limit the length.

在HTML4中,仅在输入元素上支持maxlength属性。 HTML5扩展了它以允许它在textarea上。快速测试适用于Firefox 4和WebKit,但不适用于Firefox 3或Opera。如果您需要HTML4支持,请使用JavaScript手动限制长度。

#1


22  

As to the HTML side, when the maxlength attribute is not specified, then the maximum length of the input value is unlimited. However, if you're sending the request as GET instead of POST, then the limit will depend on the webbrowser and webserver used. The HTTP 1.1 specification even warns about this, here's an extract of chapter 3.2.1:

对于HTML方面,当未指定maxlength属性时,输入值的最大长度不受限制。但是,如果您将请求作为GET而不是POST发送,则限制将取决于所使用的Web浏览器和Web服务器。 HTTP 1.1规范甚至警告过这一点,这是第3.2.1章的摘录:

Note: Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.

注意:服务器应该谨慎依赖于长度超过255个字节的URI,因为某些较旧的客户端或代理实现可能无法正确支持这些长度。

As to the webbrowsers, the practical limit is in Firefox about 8KB, in Opera about 4KB and in IE and Safari about 2KB. So the total length of all inputs should not exceed this if you want a succesful processing. As to the webservers, most have a configureable limit of 8KB. When the limit is exceeded, then it will often just be truncated, but some webservers may send a HTTP 414 error.

对于webbrowsers,实际限制在Firefox中约为8KB,在Opera中约为4KB,在IE和Safari中约为2KB。因此,如果您想要成功处理,所有输入的总长度不应超过此值。对于Web服务器,大多数都具有8KB的可配置限制。超过限制时,通常只会被截断,但某些Web服务器可能会发送HTTP 414错误。

When you're sending the request as POST, then the limit depends on the server config. Often it's around 2GB. When it's exceeded, the server will often return a HTTP 500 error.

当您以POST发送请求时,限制取决于服务器配置。通常它大约2GB。超过时,服务器通常会返回HTTP 500错误。

#2


4  

Default maxlength is unlimited for a <input type='text'/>. You may optionally provide this value to constrain input (but there's no guarentees the browser will inforce the rule).

对于,默认maxlength是无限的。您可以选择提供此值来约束输入(但是浏览器不会强制执行规则)。

A <textarea> does not support a maxlength so unlimited characters are accepted for input.

(ref: http://www.w3.org/MarkUp/HTMLPlus/htmlplus_41.html)

(参考:http://www.w3.org/MarkUp/HTMLPlus/htmlplus_41.html)

RE: Long string breaking during submit

RE:提交期间长字符串断开

There can be a maximum size to the amount of date submitted from a form when using the method get (the default if not specified). It's only a can because many browsers allow many more characters now. If you use a form with the post method, there is no maximum to the amount of data submitted.

使用方法get时,从表单提交的日期数量可以有最大大小(如果未指定,则为默认值)。它只是一个罐头,因为许多浏览器现在允许更多的字符。如果您使用带有post方法的表单,则提交的数据量没有最大值。

#3


1  

In HTML4, the maxlength attribute is only supported on the input element. HTML5 extends this to allow it on textarea as well. A quick test works in Firefox 4 and WebKit, but not Firefox 3 or Opera. If you need support for HTML4, use JavaScript to manually limit the length.

在HTML4中,仅在输入元素上支持maxlength属性。 HTML5扩展了它以允许它在textarea上。快速测试适用于Firefox 4和WebKit,但不适用于Firefox 3或Opera。如果您需要HTML4支持,请使用JavaScript手动限制长度。