Html URL 的字符数限制是多少
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1051485/
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
What is the character limit on URL
提问by Spring Monkey
What is the character limit for a URL, especially if the URL is formed from a GET method of a form.
URL 的字符限制是多少,特别是如果 URL 是由表单的 GET 方法形成的。
采纳答案by elcuco
According to Microsoft it's 2048. Since they invented the internet (and also the light, the darkness and Linux) they are right. :-) .... or.. and since IE forces this lower value, it's the lowest common denominator.
根据微软的说法,这是 2048 年。自从他们发明了互联网(还有光明、黑暗和 Linux),他们是对的。:-) .... 或者.. 因为 IE 强制使用这个较低的值,所以它是最小的公分母。
http://support.microsoft.com/kb/208427
http://support.microsoft.com/kb/208427
Under Firefox, I see people on the net reporting URLs of 0xFFFF working: http://forums.mozillazine.org/viewtopic.php?f=38&t=155648&start=0&st=0&sk=t&sd=a
在 Firefox 下,我看到人们在网络上报告 0xFFFF 的 URL 工作:http: //forums.mozillazine.org/viewtopic.php?f=38&t=155648&start=0&st=0&sk=t& sd=a
Here is another post which talks about this: http://hiox.org/index.php?id=425
这是另一篇谈论这个的帖子:http: //hiox.org/index.php?id=425
EDIT: this is very sad that almost 5 years after I wrote this answer - it is still true. If you can, look at the history of this answer.
编辑:在我写下这个答案将近 5 年后,这非常令人难过——这仍然是真的。如果可以,请查看此答案的历史记录。
EDIT2: I found a better answer on StackOverflow - What is the maximum length of a URL in different browsers?
EDIT2:我在 StackOverflow 上找到了一个更好的答案——不同浏览器中 URL 的最大长度是多少?
EDIT3: 9 years after - Explorer is deprecated in favor of Edge, Edge soon to be re-designed using Blink (making it very close to Chrome). I wonder how relevant this answer is.
EDIT3:9 年后 - Explorer 被弃用,取而代之的是 Edge,Edge 很快将使用 Blink 重新设计(使其非常接近 Chrome)。我想知道这个答案有多相关。
回答by Antoine Subit
Explanation
解释
There is no thumb rulemade for the maximum URL size of HTTP Get
Request as per RFC 2616 (Hypertext Transfer Protocol — HTTP/1.1 – Section 3.2.1).
Get
根据 RFC 2616(超文本传输协议 - HTTP/1.1 - 第 3.2.1 节),没有针对 HTTP请求的最大 URL 大小制定经验法则。
Limits are imposed by various browsersand respective servers.
These limits must be considered collectively while passing the query string passed in the URL in any of the HTTP Requests.
各种浏览器和各自的服务器都施加了限制。
在任何 HTTP 请求中传递在 URL 中传递的查询字符串时,必须共同考虑这些限制。
If the URL size exceeds the URL Size limit imposed by the respective browser, the request will not be passed to the server& unnecessary effort will be required to debug & handle this situation.
如果 URL 大小超过相应浏览器施加的 URL 大小限制,则请求将不会传递到服务器,并且需要进行不必要的调试和处理这种情况。
Maximum URL Size By...
最大 URL 大小按...
Browser
浏览器
Internet Explorer
2048 B
Microsoft Internet Explorer has a maximum uniform resource locator (URL) length of 2,083 characters. Internet Explorer also has a maximum path length of 2,048 characters. This limit applies to both POST request and GET request URLs.If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path.
Mozilla Firefox
100 KB
The address bar doesn't shows any characters beyond 65,536 characters. But the URL size can be more than that, though you cannot view it in the address bar. This holds for FireFox 1.5 up until the current FireFox version
Opera
200 KB
The URL is completely visible in the address bar even at such a big range
Chrome,Safari
100 KB
Both browsers are webkit based and seems to have almost same limit as firefox
IE浏览器
2048乙
Microsoft Internet Explorer 的最大统一资源定位符 (URL) 长度为2,083 个字符。Internet Explorer 的最大路径长度也为 2,048 个字符。此限制适用于 POST 请求和 GET 请求 URL。如果您使用 GET 方法,则限制为最多 2,048 个字符,减去实际路径中的字符数。
火狐浏览器
100 KB
地址栏不会显示超过65,536 个字符的任何字符。但是 URL 大小可以不止于此,尽管您无法在地址栏中查看它。这适用于 FireFox 1.5 直到当前的 FireFox 版本
歌剧
200 KB
即使在这么大的范围内,URL 在地址栏中也完全可见
铬,Safari
100 KB
两种浏览器都是基于 webkit 的,似乎与 firefox 的限制几乎相同
Server
服务器
Apache
128 KB
The size is changed using the LimitRequestLine setting of the server
IIS
16 KB
Default value is 16 KB and maximum limit is 16 MB
Lotus Notes
4 KB
阿帕奇
128 KB
使用服务器的 LimitRequestLine 设置更改大小
信息系统
16 KB
默认值为 16 KB,最大限制为 16 MB
莲花便笺
4 KB
Further Information
更多信息
Very long URLs are not recommended at all.
For a web based application to be cross browser compatible, the Get
Method must not be usedfor passing very long strings, containing more than 2000 characters.
完全不推荐使用很长的 URL。
对于跨浏览器兼容的基于 Web 的应用程序,该Get
方法不得用于传递包含超过 2000 个字符的非常长的字符串。
If you are facing a situation where you need to use URLs to contain huge number of characters, then give it another thought.
如果您面临需要使用 URL 来包含大量字符的情况,请再考虑一下。
回答by TPaul
Different browsers have different limits. But generally the limit is around 2,000 characters for the GET method of a URL. You can use a proxy page that does a POST method (if your API supports it) and that has a larger limit of 5,000 characters. We are currently investigating using a proxy page with the Google Map API as we have crashed into the 2,000 character limit.
不同的浏览器有不同的限制。但通常 URL 的 GET 方法的限制约为 2,000 个字符。您可以使用执行 POST 方法(如果您的 API 支持)并且具有 5,000 个字符的更大限制的代理页面。我们目前正在调查将代理页面与 Google Map API 一起使用,因为我们已达到 2,000 个字符的限制。
回答by Byron Whitlock
Newer IE: 2048 characters Some platforms support only 255.
较新的 IE:2048 个字符某些平台仅支持 255 个字符。