Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Limits on Javascript??

    Hi
    is there a maximum limit on the size a javascript can be??

    i have a large script (triple combo)
    which is to be used as a main interface within a web site
    the code is probably 4000+ lines of code long and has a file size of 1,200kb

    is this too big
    as i cannot get it to work beyond section 9 (there are 20 sections in total)

    can someone please advise if there is a better way of doing it i am currently trying to use the script on http://www.javascriptkit.com/script/...plecombo.shtml which i have split into a seperate javascript (.js file)

    thanks for any help in advance
    scott

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    there is no limit to size, just have to remember the bigger, the longer it takes to load.

    If you are doing a triple combo, you probably should be using a server side language with postback/Ajax to get the data to the client.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    If you want people to visit your web pages you have to keep the pages small enough to be usable. Approximately 50% of people will leave an 80k web page before it has finished loading so if you really want people to stay you need to keep the total initially loaded page size including all HTML, images, scripts etc below that and load the rest progressively afterwards via Ajax..
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    728
    Thanks
    35
    Thanked 132 Times in 123 Posts
    About limits-

    There is a limit to the length of an array in javascript-

    if you try to write an array longer than 4,294,967,296 items you will throw an error.

    var A=new Array(4294967295)
    A.length returns 4294967295
    but:

    var A=new Array(4294967296)
    if you try to read A.length
    a RangeError is thrown, with a message like 'invalid Array index'.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •