What is the maximum length allowed for window.returnValue property? (JavaScript)


In JavaScript, the window.returnValue property is used to return a value from a modal dialog box to the parent window. The maximum length of the value that can be returned by window.returnValue depends on the browser and operating system.

In Internet Explorer, the maximum length of window.returnValue is 4096 characters. This limit is imposed by the underlying Windows operating system, which restricts the length of data that can be passed between processes.

In other modern browsers, such as Chrome, Firefox, and Edge, there is no specific limit on the length of window.returnValue. However, there may be practical limits imposed by the amount of memory available in the browser, the size of the data being returned, and other factors.

It’s worth noting that the use of window.returnValue is specific to Internet Explorer and is not part of the standard DOM specification. Modern browsers provide other mechanisms for passing data between windows and frames, such as the window.postMessage() method, which is more flexible and secure.