How can you detect the max supported length of a URL in a browser using Javascript?
There are 2 ways to open a new tab with specific html:
var w = window.open(); w.document.write(html)
var w = window.open('data:text/html;charset=utf-8,' + encodeURIComponent(html))
The benefit of the latter is that the page can be refreshed, be bookmarked, and appear in history, but IE doesn't support urls over 2047 characters.
I could just check whether I'm in IE or not, but feature detection is much better - and maybe other browsers would also break if the url is too long. Is there a way to detect when I can open a window with specific content using a data protocol URI vs when I need to write it using JS?