In terms of file size, at what point does an external JS document become to burdensome to load? I'm considering to create separate external JS documents if this is problematic.
Thanks for your feedback.
06-01-2003, 12:31 AM
It depends. If the script doesn't have any document.write clauses, and you add defer="defer" to the script element, you can let it be far larger than the rest of the document including images. The recommendation is that you keep an upper limit of between 100k and 200k per screen/document, and preferably down to 20k-40k for fast loading on modems and other low-speed connections.
Thanks for your feedback. Based on your response, I'm in good shape. Nothing in the external JS file generates content; "defer" is false (by implication - I've not included that attribute in the 'script' tag). The file size presently is approximately 21K, and I do not see it growing much larger.
This brings to mind another question, however, if I may. Again, relating file size, what do you feel is reasonable for an external style sheet?
Thanks again, liorean.
06-01-2003, 01:00 AM
Well, that depends. If your site is graphics heavy, 20-30k would not make much difference. If your page is slim, though, I'd try to keep it at 5k-10k. Some larger sites such as news portals etc. use 50k-100k stylesheets, but then have only one stylesheet to cover all pages on their site. It takes a lot time to load first time, but then you don't have to load it again, so it's faster consecutive times. It's a bit of a trade-off between first-time load for those using cache, and each-time load for those that don't.