, - . -, .
I would recommend using iframe to store HTML and using ajax to control iframe source. When you need to download the HTML code, just specify javascript in the iframe at the URL that this HTML code will generate. This way you are limited only by regular timeouts and HTML request size limits, and not (sometimes) by more restrictive ajax restrictions.
source
share