在 Internet Explorer 中使用同步可插拔协议的自定义 url 协议的最大长度是多少?
我在 Internet Explorer 中遇到了长度超过 508 个字符的应用程序协议的硬限制。此限制在其他浏览器、chrome 等中不强制执行...
MSDN 上的文档(1) 似乎没有提及 URI 的特定于方案部分的最大允许长度或包括方案的总长度。
508 个字符远低于 IE 中 URL 的一般限制(据报告为 2083 个字符) (2)。
有谁知道这是否是预期的行为,我正在使用 IE8,或者也许我在这里出了问题?
参考文献:
< a href="http://support.microsoft.com/kb/208427" rel="noreferrer">Internet 中 URL 的最大长度为 2,083 个字符Explorer
I'm running into a hard limit in Internet Explorer with application protocol's that exceed 508 characters in length. This limit is not enforced in other browsers, chrome etc...
The documentation on MSDN(1) does not seem to mention the maximum permissible length in the scheme-specific portion of the URI or total length including scheme.
508 characters is well below general limits for urls in IE reported to be 2083 characters (2).
Does anyone know if this is expected behavior, i'm using IE8, or perhaps I've got something wrong here?
References:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最近遇到了同样的问题并提出了以下解决方案。如果您尝试像这样直接分配 URL:
您将遇到 508 个字符限制错误,并且在 IE8 中您将收到一条 JavaScript 错误,内容为“传递给系统调用的数据区域太小”。
为了解决这个问题,我从上面的代码切换到使用 JQuery 创建一个隐藏的 iframe,如下所示:
This gets around the IE 508 character limit using document.location.href 并且此解决方案适用于 IE、FireFox、Chrome 和 Safari 。
I recently ran into this same problem and come up with the following solution. If you try to assign the URL directly like this:
you will run into this 508 character limit error and in IE8 you'll get a JavaScript error saying something about The "data area passed to a system call is too small."
To get around this problem, I switched from the above code to using JQuery to create an hidden iframe like this:
This gets around the IE 508 character limit using document.location.href and this solution works for IE, FireFox, Chrome, and Safari.
我认为浏览器在分离协议之后,将其存储在固定大小的临时缓冲区中。为什么,我不知道,这似乎是未来可能会改变的行为。不要指望它。
我还想知道为什么你需要这么长的协议。即使
GUID
用十六进制数字加破折号表示也只有 36 个字符。I think that the browser, after splitting off the protocol, stores it in a temporary buffer of a fixed size. Why, I don't know, and this seems like behaviour that might change in the future. Don't bank on it.
I'm also wondering why you'd need a protocol this long. Even a
GUID
is only 36 characters when expressed as hex digits plus dashes.