max string length?

i'm trying to put a string literal whose length is over 280,000 bytes into a javascript string variable.  when i load the page into netscape the disk spins a really long time, and i end up killing the netscape session.  i'm running netscape 4.05 on SGI IRIX 6.3.   so, is there a maximum string length?  is there a way to work around this?
Who is Participating?
Michel PlungjanConnect With a Mentor IT ExpertCommented:
I have never tried 280.000 bytes but whenever I need a big string, I build it like this - seems to work on quite big strings, definitely more than 256 bytes ;-):

var BigString = 'First part of a really big string';
    BigString += 'Next part of a really big string';
    BigString += 'Next part of a really big string';
I read somewhere recently that Javascript has a string limitation of 255 characters although I can't find the documentation at the moment.  It certainly will not take a string of 280,000 bytes (which is 280,000 characters AFAIK).  You could split the string up into smaller chunks but this will give you a lot of small strings and may not be a viable option.  You would then need to rebuild at the point where you use them something like:

(assuming you want to write it to the screen)

Looking at the line above you could probably write a for..loop to go through all the strings you have.  Possibly even store al the string names in an array.



Isn't that method going to give you one string at the end though of 280,000 bytes?


Michel PlungjanIT ExpertCommented:
Yes, but it seems Netscape can handle this a lot bettter than
var BigString = 'a huge number of bytes in one go.................................';

I have used the above example to generate complete listings of several tens of thousands of bytes - Not 280.000 I admit, but let's see what clemwang replies

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.