Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7791973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:03:36+00:00 2026-06-01T22:03:36+00:00

I have read a few articles online about optimizing javascript loading. A few key

  • 0

I have read a few articles online about optimizing javascript loading.
A few key points I got is to minimize the number of script files (http requests), minify and enable gzip on the server. Currently, what is done on my side is that all javascript files are minified, and gzip can be simply enabled as well.

Part 1)

My problem is that I have around 20 javascript files, there is one common.js that has all the core functions. Besides that, every page would load at least one other file that implements the functionality of that page.

Solution 1, is to combine all scripts in one big script file, and get loaded once for each client, which seems to be what everyone else is doing. I guess YUI or JSMin can be used for compressing, so I should combine the files manually?

Solution 2, lazy loading when a required function is needed, I don’t really know how this works, but it seems to be a way to do it, though still requires more http requests. I would love to hear any inputs for this.

Part 2)

The web application I am working on will be deployed to many other computers, since javascripts are pretty small, is it a good practice to make a script that dynamically load the newest script from a central server, so that every client will run the newest script?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:03:37+00:00Added an answer on June 1, 2026 at 10:03 pm

    Part 1: Like you said, there’s two approaches.

    • Solution 1 is valid, and there are tools out there to do this, including Google’s Closure Compiler. The problem is in most cases it needs every single script on your site to be included in order to work properly, so regardless of what your page might use, it gets everything
    • Solution 2 is also valid, but like you said doesn’t really prevent the multiple http requests. But it’s good in that it only loads what you need, when you need it, and doesn’t create any blocking calls on the initial page load. Head.js is an option that was mentioned, as well as Require.js and others.

    Part 2:

    • There are ways to force the browser to always download the latest javascript file, although this kind of negates the benefit of browser caching. One common way is to add a get variable to the end of the javascript URL, i.e. “domain.com/index.js?timestamp=_123123123”. This is similar to what jQuery does when you turn off caching for its ajax calls.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read a few articles on Internet about programming language choice in the
I have read few good articles about NHibernate localization but nothing seems to fit
I have read a few articles about how to programmatically interacting with Active Directory.
I have read a few articles about this, however, none of them tell me
I'm fairly new to DDD and have read a few articles about the concept
I have read a few articles, I can't see why one would use html5
I have asked a few questions on here and read a few articles around
In the past few years I have read plenty of articles on Foreign Keys
I've read a few of the articles about the need / applicability / practicality
I read a few other articles about how people want to customize the colors

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.