Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Large text in TextArea freezes computer

Tags:

html

textarea

When I try to set the value of a textarea with a large text (for example a string length of 600000), the browser (Firefox 3.5.3) freezes.

The text is in 1 line so text wrapping needs to happen by the textarea itself. I think this causes the problem.

Does anyone know a fix for this problem?

like image 740
jeroen.verhoest Avatar asked Oct 21 '09 12:10

jeroen.verhoest


3 Answers

Disable the spell checker (in Firefox 7.0 uncheck the 'Check my spelling as I type' option in the Preferences window).

You can also add the spellcheck="false" attribute to the textarea in HTML.

like image 147
Lucian Avatar answered Oct 04 '22 01:10

Lucian


The maximum size for a textarea in Firefox is 64K (it could be just 32K, I can't recall). 600,000 characters is larger than that. If the size of the text that you're pasting into the textarea does in fact exceed that size, then there's nothing you can do about it.

Of course, one alternative would be to put some type of restriction on the data going into the field and then give the user some feedback as to why their data won't fit.

like image 42
Tom Avatar answered Oct 04 '22 01:10

Tom


The answer comes certainly a bit late, but in order to speed up your paste operations of large chunks of text in a textarea or editable div, simply disable autocomplete:

<div onClick="this.contentEditable='true';" autocomplete="off">
  lorem ipsum dolor lorem ipsum dolorlorem ipsum dolor
</div>
like image 26
plang Avatar answered Oct 04 '22 01:10

plang