can anyone help me with the length of maximum characters that can be contain in a normal 开发者_开发知识库HTML text box....
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:
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.
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.
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.
Default maxlength
is unlimited for a <input type='text'/>
. You may optionally provide this value to constrain input (but there's no guarantees the browser will enforce the rule).
A <textarea>
does not support a maxlength
so unlimited characters are accepted for input.
(ref: https://www.w3.org/MarkUp/HTMLPlus/htmlplus_41.html)
RE: Long string breaking during submit
There can be a maximum size to the amount of data 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.
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.
精彩评论