473,320 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

size of Javascript file

184 100+
Hi All,
Is there a max limit on the size of a Javascript file that can be used in web environment?

How can we set header/expires for a Javascript file alone (and not for the entire JSP,HTML, etc).

please correct me if i'm wrong.. do needfull.
Thanks.
Jan 23 '09 #1
13 5758
acoder
16,027 Expert Mod 8TB
What size are we talking about here? What problem does it cause?

You can set headers if you use JSP to generate the JavaScript file and include like this:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="includes/js.jsp"></script>
Jan 23 '09 #2
gaya3
184 100+
@acoder

Hi Acoder,
1. since my application has 80 -90 javascript files to load,it causes performance issue.hence i started combining the javascript files.And thus, is there any limit for maximum size of javascript in web environment?
2. yes Acoder ,ofcourse,what u said is rite for header/expires.But my query is very close to javascript. for jsp we can set header/expires.. But for me header/expires need to be set only static content (javascript).

Hope u got my query?
Jan 23 '09 #3
gits
5,390 Expert Mod 4TB
to reduce the filesize of JavaScript(s) you may use a 'minifyier', which just drops useless whitespaces etc. ... in you productive version of the script-file(s). have a look here to get the basic idea of it.

kind regards
Jan 23 '09 #4
acoder
16,027 Expert Mod 8TB
That is a lot of files. Are you sure you need that many? The limit depends on the browser and the system. Also, note that once you include a file using script tags, it can be cached, so page load the second time round should be faster.
Jan 23 '09 #5
gaya3
184 100+
@acoder
Acoder,
yeah!... Acoder.. ofcourse, time taken to load the second round should be less , because of caching. Eventhough it cached the request for the javascript files in web server is received.. and hence again causing the time delay (performance issue) to load the page.
Jan 23 '09 #6
gaya3
184 100+
@gits
Gits,
Thanks for your inputs.. is there any other way to reduce the file size other than using tools like JSmin etc... And more is , from your refrence link
i found the below comment
"you should use a build script to reduce the size of JavaScript and CSS before every deployment stripping comments and whitespace"..

what does build script means?
Jan 23 '09 #7
gits
5,390 Expert Mod 4TB
@gaya3
of course ... you could do it manually ... ;) ... and/or use the gzip-compression (when your webserver is able to do so) ... have a look here

@gaya3
this is a script that just starts to minify the files when you want to deploy it to the productive machine ... so you don't need to minify your dev-version so that you could easyly work with them ... and while this is not required in the production version every comment etc. could be dropped before releasing the files to production

kind regards
Jan 23 '09 #8
gaya3
184 100+
Gits,
Thanks for your inputs... From the link you suggested, i found the below comment...
"For static components: implement "Never expire" policy by setting far future Expires header "
How do i set the expires for static components... pl provide me some samples for javascript....
Jan 24 '09 #9
gaya3
184 100+
@gits
Gits,
As mentioned in the refrenced link... where do i suppose to add the
below comments in my application.. in header?
" Accept-Encoding: gzip, deflate
Content-Encoding: gzip"
if so please provide me some samples....
Does Gzipping reduces the response size by about 70% ? really?
will the time taken to download the javascript file get reduce?
Jan 24 '09 #10
gits
5,390 Expert Mod 4TB
i think both of it has to be done through the Apache configuration ... may be this link does help you?

kind regards
Jan 25 '09 #11
gaya3
184 100+
Ho ! ok Gits.. could you please say me how to add "Never expires" for the static components (javascript files) in headers.
Jan 27 '09 #12
gits
5,390 Expert Mod 4TB
hi ... i'm not an Apache expert ... and as i said i think it is a webserver configuration issue ... may be you should ask in the corresponding forum which depends on the webserver you use ...

kind regards
Jan 27 '09 #13
Dormilich
8,658 Expert Mod 8TB
@gaya3
if you have Apache and the mod_headers module installed, have a look at the above mentioned link. otherwise you may try the ExpiresByType directive
Jan 27 '09 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: vishal | last post by:
hi is there anyway that i can check the size of file on client side before uploading file to server???? suppose the user uploads file of 10 mb then the server will know the size is 10 mb...
21
by: ryanmhuc | last post by:
I know the subject might be confusing. I am no beginner with javascript but I haven't been able to figure out how to get the javascript file name from code inside the file. So you have an HTML...
35
by: munish.nr | last post by:
Hi All, I want to know the size of file (txt,img or any other file). i knoe only file name. how i can acheive this. does anybody is having idea about that. plz help. rgrds, Munish Nayyar
3
by: Angel | last post by:
Is there any way to debug a javascript file that I included in my ASP.net project. or some reason when I call a javascript function in the file from my ASP.NET code I get an error message. now if i...
24
by: gizoto316 | last post by:
I was wondering if it was possible to have php code in a javascript file. I have a java file with a bunch of functions on it and I wanted to add one where the action has php code in it. When i...
5
by: josh.tucholski | last post by:
I'm looking for some tools that allow us to implement Javascript Header File Compression. I know there are parsers out there that kill all the commenting and obliverate the code to make it as...
17
by: NeoAlchemy | last post by:
I am starting to find more web pages that are using a query parameters after the JavaScript file. Example can be found at www.opensourcefood.com. Within the source you'll see: <script...
9
by: Mahernoz | last post by:
Hello Friends, The JavaScript File exmplmenu_var.js contains the code... (for the sake of brevity i am showing only that code which needs to be changed) I am actually developing a menu using...
2
by: JohnLorac | last post by:
Hello, I'm trying to load and write file on local disc drive using signed javascript file. But I have experienced problem running this url: ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.