Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prompt max length

Using prompt() I am generating some html to and need to know the maximum length that I can put in the popup.

I can't find anything in the spec about this, wondering if someone can help

like image 657
lededje Avatar asked Apr 12 '13 10:04

lededje


2 Answers

Here are some real world numbers in case anyone is interested. Please add more if you have any.

Using the following code in the browser console:

s = prompt("a", Array(SOME_NUMBER).join("0")); s.length;

  • Chrome 43 - 2000 with ellipses as mentioned by @Redzarf.
  • Firefox 39 - Reached 10,000,000 then stopped testing (browser runs slowly while this is executing. You may get the 'non responsive script' alert as well).
  • IE 11 - Reached 10,000,000 then stopped testing.
like image 130
Paul Grime Avatar answered Sep 25 '22 17:09

Paul Grime


The ECMAScript Programming Language Specification does not specify any maximum length. The maximum length with will be implementation-specific i.e, based on available memory.

like image 44
karthick Avatar answered Sep 21 '22 17:09

karthick