473,236 Members | 1,549 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,236 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 5752
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: ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...

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.