Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

does browser download completely include javascript file?

Posted on 2002-05-27
9
Medium Priority
?
227 Views
Last Modified: 2013-11-18
If I put this in a html file:
<script language="javascript" src="file.js">
 Will the browser download the whole .js file? Or it just download the only functions that are called in html file? The matter is that I have a .js file with a lot of functions as a library but not every html page is using all functions. Just need to know if this will waste downloading time. Thanks
0
Comment
Question by:quanghoc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 30

Accepted Solution

by:
third earned 600 total points
ID: 7038003
yes it will download the whole .js file in the user's temporary internet files folder.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7038009
Include a file will download the whole. This includes all variables.


hongjun
0
 
LVL 30

Expert Comment

by:third
ID: 7038015
if it's really huge then i guess it's advisable to put the common functions used into one .js file and call this in each of your pages. the other functions should reside to other individual .js file. only the pages that needs this function should reference the .js file.

so for example a page needs the common functions file and the specific functions file you can add two extenal .js file to your page.

<script language="javascript" src="file.js">
<script language="javascript" src="specific.js">
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 33

Expert Comment

by:hongjun
ID: 7038018
third, good illustration on the effective use of js files.

hongjun
0
 
LVL 30

Expert Comment

by:third
ID: 7038024
thanks! ;-)
0
 
LVL 1

Author Comment

by:quanghoc
ID: 7038107
So basically, the whole thing will be downloaded, including "comments" ?? What if the .js file has included another .js file?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7038126
yap
comments as well.

js file include another js file?
how you do that!!!

hongjun
0
 
LVL 30

Expert Comment

by:third
ID: 7038174
add info:

.js files cannot include another .js file. if you want to include two separate .js files on the web page, do what i have illustrated above.

thanks for the A! ;-)
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7038329
well deserved!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question