What is the maximum length of a custom url protocol using synchronous pluggable protocols in Internet Explorer?

I encountered a severe restriction in Internet Explorer with an application protocol that is longer than 508 characters. This limit does not apply in other browsers, chrome, etc.

The MSDN ( 1 ) documentation does not seem to mention the maximum allowable length in part of the URI for a particular scheme or the total length including the scheme.

508 characters are well below the general restrictions for URLs in IE, which are reported to be 2083 characters ( 2 ).

Does anyone know if this is the expected behavior, I am using IE8, or maybe I have something wrong here?

Literature:

+6
source share
2 answers

I recently ran into this problem and came up with the following solution. If you try to assign the URL as follows:

document.location.href = theUrlWithTheCustomProtocol; 

you will encounter this limit error of 508 characters, and in IE8 you will receive a JavaScript error saying that "the data area passed to the system call is too small."

To get around this problem, I switched from the above code to using jQuery to create a 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 wraps around the character limit of IE 508 using document.location.href, and this solution works for IE, FireFox, Chrome, and Safari.

+4
source
 508 + some bookkeeping = 512 bytes 

I think that the browser, having split the protocol, saves it in a temporary buffer of a fixed size. Why, I do not know, and this is similar to behavior that may change in the future. Do not take care of him.

I am also wondering why you will need a protocol for a long time. Even a GUID is only 36 characters if it is expressed as hexadecimal digits plus a dash.

+3
source

Source: https://habr.com/ru/post/906931/


All Articles