473,830 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

limit on number or size of javascript variables

Hi,

I am in the process of designing a UI which has to be fairly sophisticated.
There will be a number of list boxes and other controls, with pop-up windows
to edit certain properties. It's the kind of thing I would normally have
done in VB but I want it to be browser-based. I've only used javascript for
trivial things before so this would be my first serious javascript
development. I would like it to run on all reasonably recent browsers.

The form starts with all the initial values being received from the server
(presumably just by pre-initialised data structures). The user tinkers with
it and when he is happy he presses 'submit' and the whole lot is submitted
to the server (presumably as a form post). This would be a few kb of data,
possibly 100 individual values but obviously in various data structures. I
guess there would be a few hundred lines of javascript code to manipulate
it.

My question is, is there likely to be a problem with manipulating and
sending this amount of data in Javascript. Sorry if this is a dumb question,
but like I said, I only used javascript for tiny programs before, so I'm a
bit unsure about its capabilities.

Boastful replies of the form "I have an X thousand line javascript program
that runs in all browsers and manipulates Y megabytes of data" would be most
welcome :)

Andy

Jul 20 '05 #1
2 12977
Steven Dilley wrote:
"Andy Fish" <aj****@blueyon der.co.uk> wrote in message
news:Tp******** ***********@new s-text.cableinet. net...

I am in the process of designing a UI which has to be fairly

sophisticated.
The form starts with all the initial values being received from the server
(presumably just by pre-initialised data structures). The user tinkers

with
it and when he is happy he presses 'submit' and the whole lot is submitted
to the server (presumably as a form post). This would be a few kb of data,
possibly 100 individual values but obviously in various data structures. I
guess there would be a few hundred lines of javascript code to manipulate

it.

My question is, is there likely to be a problem with manipulating and
sending this amount of data in Javascript. Sorry if this is a dumb

question,
but like I said, I only used javascript for tiny programs before, so I'm a
bit unsure about its capabilities.


Not a dumb question, but one based on a lack of background.
Javascript does not submit the data; the form does that.
The values are not javascript variables. In fact, your form does
not seem to need any Javascript at all, unless there is something you
haven't mentioned. Forms using the 'get' method are restricted to
(I think) 256 bytes, but the 'post' method can easily handle your few kb of
data.


While I wouldn't suggest using a URI longer than about 256 characters, I did do
some testing and this is what I found:

There is a restriction on the length of a URI (including any parameters). In
IE6SP1, the longest URI I could construct that would not be truncated was 2083
bytes:

<body onload="alert(w indow.location. href.length);">
<script type="text/javascript">
String.prototyp e.repeat = function(times) {
return (new Array(times + 1)).join(this);
}

var s = "X";
s = s.repeat(2003);

document.write( '<a href="hs~new.ht m?p=' + s + 'Y">Test</a>');
</script>

Note that in my case, the original URL was 77 bytes, adding '?p=', the repeating
X and the Y brought it to 2083. Anything longer then that and IE simply dropped
everything after the '?' when navigating to the new page. Netscape 4.78, Mozilla
1.5a and Opera 7.11 had no problems with longer URL, although I did not actually
test to see if client-side JavaScript was capable of reading the passed values.

I also didn't test the maximum length of URI that every browser can recognize,
but it seems that the "big three" modern browsers can handle URI well in excess
of 256 characters.

Also be aware that someone else performed similar tests and got slightly
different results (I believe they were able to construct a URI of only 2076
bytes in IE).

--
| Grant Wagner <gw*****@agrico reunited.com>

Jul 20 '05 #2
OK, maybe I should be clearer about my requirements.

The user will be maintaining a small set (2-10) of records. Because of the
interrelationsh ips between the records I don't want to commit changes each
time the user navigates, so I want to store the data in an array of
structures (sorry if this is not the correct javascript terminonogy). As the
user navigates between the records the javascript will populate the fields
on the screen and copy changes back into the array. When the user is happy,
he presses the 'submit' button and all the changes are submitted,

so the fields he sees on the screen aren't directly what gets posted to the
server. I thought I might build all the results into an XML string and post
it in a hidden text field or something, but I haven't really gone that far
into the design yet.

This is the way I would have done it in VB, but I'm not sure if this makes
sense for javascript

Thanks

Andy

"Steven Dilley" <steven.dilley. at.compuware.co m> wrote in message
news:3f******** @10.10.0.241...
"Andy Fish" <aj****@blueyon der.co.uk> wrote in message
news:Tp******** ***********@new s-text.cableinet. net...

I am in the process of designing a UI which has to be fairly sophisticated.
The form starts with all the initial values being received from the server (presumably just by pre-initialised data structures). The user tinkers

with
it and when he is happy he presses 'submit' and the whole lot is submitted to the server (presumably as a form post). This would be a few kb of data, possibly 100 individual values but obviously in various data structures. I guess there would be a few hundred lines of javascript code to manipulate it.

My question is, is there likely to be a problem with manipulating and
sending this amount of data in Javascript. Sorry if this is a dumb question,
but like I said, I only used javascript for tiny programs before, so I'm

a bit unsure about its capabilities.


Not a dumb question, but one based on a lack of background.
Javascript does not submit the data; the form does that.
The values are not javascript variables. In fact, your form does
not seem to need any Javascript at all, unless there is something you
haven't mentioned. Forms using the 'get' method are restricted to
(I think) 256 bytes, but the 'post' method can easily handle your few kb

of data.
The number of individual values is not relevant. The only data structure
involved will be the Response object.

You will need some server-side scripting to deal with the data sent by the
form (asp/jsp/php), and that can be of any size.

--
Steve

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3157
by: Noyb | last post by:
I've set up a news links section using the RSS parsing tutorial found here: http://www.sitepoint.com/article/560 Everything works great but depending on the feed source there may be 3 news links or 30. How can I limit the amount of titles, descriptions, and links output to be no more than 10? Thanks, Steve.
1
7270
by: Gerard Cany | last post by:
I have a problem with a javascript that seems related to the number/size of parameters sent by the form The method for the form is POST (not GET, I know the size limit with GET) The symptom : some times, I receive a javascript error "Invalid syntax on line xxx", this line contains the call to submit as shown in the following lines : <input type="button" value="<%=Session("Bouton_EnregistrerFicheInclusion")%>"
3
5115
by: Ana | last post by:
I have written some code using transient cookies to send an edited essay from one html page to another. Each paragraph of the essay is saved in separate cookie. If the essay is 4 paragraphs long then I write 4 different cookies. This works on a Macantosh in Internet Explorer but for some reason on a PC the cookies turn up empty. If I make the essay shorter then it works on a PC, so it looks as if I am running up against the size...
3
2900
by: ken | last post by:
Hi, I was wondering how the 4k table record limit is counted. I have access 2k. I text fields are 256 chars. Memo fields are not included in the calculation. What about yes/no fields would that be just 1 char? also integers they are probably not included either? I just need to make sure none of my tables exceeds the limit. Thanks
9
10852
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using LDIFDE as a comparison I get the same results. No members means just that, an empty group. Zero means that the DirectorySearcher.SizeLimit has been exceeded....
11
1994
by: VB Programmer | last post by:
Is there a limit as to how big an aspx page's html can be? (number of characters) Why do I ask? I have a webform with a lot of ActiveX controls (shows up as OBJECT in html). When I place like 35 of these objects the form shows up BLANK in a web browser. When I remove a few (ANY few) I can see the page. Any ideas? Thanks.
3
13144
by: Jefferis NoSpamme | last post by:
Hello all, I'm trying to limit the file size to 1 meg on upload of image files and I am trying a script from javascript internet, but it is giving me errors on IE ² is null or not an object ³ and isn¹t checking the file size or preventing the upload. ERROR IS <<<<Œthis.form.uploadfile.value² is null or not an object on this line:
1
2368
by: HopfZ | last post by:
Internet Explorer 6 bookmarklets(favlets) has size limit. And its size limit depend on the kind of code. For example, CODE A and CODE B (below) are both at their size limit. CODE A does not work (as a bookmarklet), but if you replace the number 44444 at the end to 4444, then it works. CODE B is much longer than CODE A, but if you replace OO in the regular expression to O, then it works. I don't know why they have different size limits....
30
8322
by: Jeff Bigham | last post by:
So, it appears that Javascript has a recursion limit of about 1000 levels on FF, maybe less/more on other browsers. Should such deep recursion then generally be avoided in Javascript? Surprisingly, deep recursion actually isn't that slow for what I'm doing. Programming this task recursively is so much more straightforward to me, but currently I'm forced to use an ugly hack to avoid going over the 1000 level limit. Of course, it could...
0
9793
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6950
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.