What is the maximum length of a URL in different browsers?
https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
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.
If you are targeting particular browsers, see below for more details specific limits.
Longer answer - first, the standards...
RFC 2616 (Hypertext Transfer Protocol HTTP/1.1) section 3.2.1 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 than the server can handle (see section 10.4.15).
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:
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.
...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:
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.
(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...)
Internet Explorer's limitations...
IE8's maximum URL length is 2083 chars, and it seems IE9 has a similar limit.
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.
There's a nice writeup on the IE Internals blog which goes into some of the background to this.
There are mixed reports IE11 supports longer URLS - see comments below. Given some people report issues, the general advice still stands.
Search engines like URLs < 2048 chars...
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)
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.
Additional browser roundup
I tested the following against an Apache 2.4 server configured with a very large LimitRequestLine and LimitRequestFieldSize.
Browser Address bar document.location
or anchor tag
------------------------------------------
Chrome 32779 >64k
Android 8192 >64k
Firefox >64k >64k
Safari >64k >64k
See also this answer from Matas Vaitkevicius below.
Is this information up to date?
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 Nov 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.
What is the maximum length of a URL in different browsers?的更多相关文章
- Maximum length of a table name in MySQL
http://dev.mysql.com/doc/refman/5.7/en/identifiers.html The following table describes the maximum le ...
- [LeetCode] Maximum Length of Repeated Subarray 最长的重复子数组
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arra ...
- [Swift]LeetCode718. 最长重复子数组 | Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arra ...
- oracle 导入报错:field in data file exceeds maximum length
今天用sqlldr导入数据时候报错: " Record 1: Rejected - Error on table ks_test, column khname.Field in data f ...
- [LeetCode]Maximum Length of Repeated Subarray
Maximum Length of Repeated Subarray: Given two integer arrays A and B, return the maximum length of ...
- sqlldr Field in data file exceeds maximum length "
使用sqlldr导数时出现如下错误: " Record 1: Rejected - Error on table PC_PLANNAME, column PLANNAME.Field in ...
- LeetCode Maximum Length of Pair Chain
原题链接在这里:https://leetcode.com/problems/maximum-length-of-pair-chain/description/ 题目: You are given n ...
- FireDAC 出现Variable length column[*] overflow. Value length - [80], column maximum length
FireDAC 出现Variable length column[*] overflow. Value length - [80], column maximum length FireDAC的 TF ...
- 718. Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arra ...
随机推荐
- 升级安装go1.13.5
运行文件时报错 verifying github.com/mattn/go-isatty@v0.0.10-0.20190818123653-bf9a1dea1961/go.mod: github.co ...
- 第一个flink application
导入maven依赖 需要注意的是,如果使用scala写程序,导入的依赖跟java是不一样的 Maven Dependencies You can add the following dependenc ...
- 最小编辑距离python
1 什么是编辑距离在计算文本的相似性时,经常会用到编辑距离(Levenshtein距离),其指两个字符串之间,由一个字符串转成另一个所需的最少编辑操作次数.在字符串形式上来说,编辑距离越小,那么两个文 ...
- spring源码 继承AttributeAccessor的BeanDefinition接口
/** * A BeanDefinition describes a bean instance, which has property values, * constructor argument ...
- ThinkPHP 5.0远程命令执行漏洞分析与复现
0x00 前言 ThinkPHP官方2018年12月9日发布重要的安全更新,修复了一个严重的远程代码执行漏洞.该更新主要涉及一个安全更新,由于框架对控制器名没有进行足够的检测会导致在没有开启强制路由的 ...
- mybatis今年笔记
1.读取配置文件:用的就是解析Xml文件的技术 2.mybatis是支持自己写dao层的,但是没有必要. mybatis做的事情: 第一个创建代理对象,第二个在代理对象中调用方法. 3.相同的注解如果 ...
- Windows操作系统安装JDK环境
Windows操作系统安装JDK环境 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一. Java常见的术语 1>.什么是JVM 只要在需要运行Java应用程序的操作系统上 ...
- 2019-9-16 java上课知识整理总结(动手动脑,课后实验)
java上课知识整理总结(动手动脑,课后实验) 一,课堂测试 1,题目:课堂测试:像二柱子那样,花二十分钟写一个能自动生成30道小学四则运算题目的 “软件” 要求:(1)题目避免重复: (2)可定制( ...
- Day3-T3
原题目 Describe:又是这种最大子矩阵捆绑一堆条件的题 code: #pragma GCC optimize(2) #include<bits/stdc++.h> #define j ...
- Python爬虫实战(一) 使用urllib库爬取拉勾网数据
本笔记写于2020年2月4日.Python版本为3.7.4,编辑器是VS code 主要参考资料有: B站视频av44518113 Python官方文档 PS:如果笔记中有任何错误,欢迎在评论中指出, ...