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:
Asynchronous Pluggable Protocols
Maximum URL length is 2,083 characters in Internet Explorer
I recently ran into this same problem and come up with the following solution. If you try to assign the URL directly like this:
document.location.href = theUrlWithTheCustomProtocol;
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:
// Remove old frame
$('#hiddenIFrame').remove();
// Add new one
$('<iframe />', {
'id': 'hiddenIFrame',
'name': 'hiddenIFrame',
'src': theUrlWithTheCustomProtocol,
'style': 'display: none;'
}).appendTo("body");
This gets around the IE 508 character limit using document.location.href and this solution works for IE, FireFox, Chrome, and Safari.
508 + some bookkeeping = 512 bytes
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With