What is the maximum length of html textbox

前端 未结 3 1610
栀梦
栀梦 2021-02-14 02:11

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

3条回答
  •  北海茫月
    2021-02-14 02:41

    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.

提交回复
热议问题