什么是不同的浏览器的URL的最大长度? [英] What is the maximum length of a URL in different browsers?

查看:2004
本文介绍了什么是不同的浏览器的URL的最大长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是不同的浏览器的URL的最大长度?是否浏览器之间有什么不同?

What is the maximum length of a URL in different browsers? Does it differ between browsers?

请问HTTP协议规定呢?

Does the HTTP protocol dictate it?

推荐答案

如果你把网址下2000个字符,他们将工作在客户端和服务器软件的任意组合。

Short answer - de facto limit of 2000 characters

If you keep URLs under 2000 characters, they'll work in virtually any combination of client and server software.

RFC 2616 (超文本传输​​协议HTTP / 1.1)第3.2.1节说:

RFC 2616 (Hypertext Transfer Protocol HTTP/1.1) section 3.2.1 says

HTTP协议不到位
  上的长度的任何先验限制
  一个URI。服务器必须能够处理
  他们所服务的任何资源的URI,
  并应能够处理的URI
  如果他们能提供无限的长度
  GET-基于可能产生形式
  这样的URI。服务器应该返回
  如果一个414(请求URI太长)状态
  URI长于服务器
  手柄(见10.4.15)。

The HTTP protocol does not place any a priori limit on the length of a URI. Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length if they provide GET-based forms that could generate such URIs. A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can handle (see section 10.4.15).

这是RFC已过时由 RFC7230 这是HTTP / 1.1规范的刷新。它包含了类似的语言,而且还进一步建议是:

That RFC has been obsoleted by RFC7230 which is a refresh of the HTTP/1.1 specification. It contains similar language, but also goes on to suggest this:

在请求线路长度各种临时性限制在被发现
  实践。我们建议所有的HTTP发件人和收件人
  8000个字节的支持,至少,请求线的长度。

Various ad hoc limitations on request-line length are found in practice. It is RECOMMENDED that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.

这是什么的标准的说。对于的实际的,请参阅这一研究过在boutell.com 看什么个人的浏览器和服务器实现支持。这是值得一读,但执行摘要是:

...and the reality

That's what the standards say. For the reality, see this research over at boutell.com to see what individual browser and server implementations will support. It's worth a read, but the executive summary is:

极长的URL通常一个
  错误。 超过2,000字符的URL
  不会在最流行的网络工作
  浏览器。
不要使用他们,如果你打算
  您的网站,为广大合作
  互联网用户。

Extremely long URLs are usually a mistake. URLs over 2,000 characters will not work in the most popular web browsers. Don't use them if you intend your site to work for the majority of Internet users.

(注意:这是写在 2006 的,但在2015年IE的下降,使用率意味着较长的URL的的为广大的工作。不过,IE的一篇文章报价。仍然有局限性...)

(Note: this is a quote from an article written in 2006, but in 2015 IE's declining usage means that longer URLs do work for the majority. However, IE still has the limitation...)

IE8的最大URL长度为2083个字符,它似乎的IE9也有类似的限制

我测试IE10和地址栏只接受2083个字符。你可以的点击的一个URL比这更长,但地址栏仍然会只显示该链接的2083个字符。

I've tested IE10 and the address bar will only accept 2083 chars. You can click a URL which is longer than this, but the address bar will still only show 2083 characters of this link.

有一个 href=\"https://blogs.msdn.microsoft.com/ieinternals/2014/08/13/url-length-limits/\">好的书面记录这进入一些背景本的。

There's a nice writeup on the IE Internals blog which goes into some of the background to this.

有混合报告IE11支持更长的URLS - 见下面的评论。鉴于有些人报告问题,一般的建议仍然有效。

There are mixed reports IE11 supports longer URLS - see comments below. Given some people report issues, the general advice still stands.

请注意, Sitemaps协议,它允许一个站点,告知搜索引擎有关可用的页面,有一个极限在网址2048个字符。如果你打算使用Sitemap,限制已决定为您服务! (请参见克林 - 安德烈Burloiu的回答下文)

Be aware that the sitemaps protocol, which allows a site to inform search engines about available pages, has a limit of 2048 characters in a URL. If you intend to use sitemaps, a limit has been decided for you! (see Calin-Andrei Burloiu's answer below)

有也从2010年的一些研究到<一个href=\"http://www.seomofo.com/experiments/title-and-h1-of-this-post-but-for-the-sake-of-keyword-prominence-stuffing-im-going-to-mention-it-again-using-various-synonyms-stemmed-variations-and-of-coursea-big-fat-prominent-font-size-heres-the-stumper-that-stumped-me-what-is-the-max-number-of-chars-in-a-url-that-google-is-willing-to-crawl-and-index-for-whatever-reason-i-thought-i-had-read-somewhere-that-googles-limit-on-urls-was-255-characters-but-that-turned-out-to-be-wrong-so-maybe-i-just-made-that-number-up-the-best-answer-i-could-find-was-this-quote-from-googles-webmaster-trends-analyst-john-mueller-we-can-certainly-crawl-and-index-urls-over-1000-characters-long-but-that-doesnt-mean-that-its-a-good-practice-the-setup-for-this-experiment-is-going-to-be-$p$ptty-simple-im-going-to-edit-the-permalink-of-this-post-to-be-really-really-long-then-im-going-to-see-if-google-indexes-it-i-might-even-see-if-yahoo-and-bing-index-iteven-though-no-one-really-cares-what-those-assholes-are-doing-url-character-limits-unrelated-to-google-the-question-now-is-how-many-characters-should-i-make-the-url-of-this-post-there-are-a-couple-of-sources-ill-reference-to-help-me-make-this-decision-the-first-is-this-quote-from-the-microsoft-support-pages-microsoft-internet-explorer-has-a-maximum-uniform-resource-locator-url-length-of-2083-characters-internet-explorer-also-has-a-maximum-path-length-of-2048-characters-this-limit-applies-to-both-post-request-and-get-request-urls-the-second-source-ill-cite-is-the-http-11-protocol-which-says-the-http-protocol-does-not-place-any-a-priori-limit-on-the-length-of-a-uri-servers-must-be-able-to-handle-the-uri-of-any-resource-they-serve-and-should-be-able-to-handle-uris-of-unbounded-length-if-they-provide-get-based-forms-that-could-generate-such-uris-a-server-should-return-414-request-uri-too-long-status-if-a-uri-is-longer.html\">maximum搜索引擎将抓取和索引 URL的长度。他们发现限为2047个字符,这似乎结盟Sitemap协议规范。然而,他们也发现了谷歌 SERP 工具不会与网址超过1855个字符长应对。

There's also some research from 2010 into the maximum URL length that search engines will crawl and index. They found the limit was 2047 chars, which appears allied to the sitemap protocol spec. However, they also found the Google SERP tool wouldn't cope with URLs longer than 1855 chars.

这是一个受欢迎的问题,作为原研为〜9岁,我会尽量保持最新:截至 2016年8月的建议仍然有效。即使IE11有可能接受较长的URL,老年IE的安装,加上搜索引擎的局限性的普及意味着停留在2000个字符是最好的总政策。

This is a popular question, and as the original research is ~9 years old I'll try to keep it up to date: As of Aug 2016, the advice still stands. Even though IE11 may possibly accept longer URLs, the ubiquity of older IE installations plus the search engine limitations mean staying under 2000 chars is the best general policy.

这篇关于什么是不同的浏览器的URL的最大长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆