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

  • SEARCH
  • Home
  • 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 1051155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:53:10+00:00 2026-05-16T16:53:10+00:00

Ok, so I know that it’s obvious to combine all of a pages Javascript

  • 0

Ok, so I know that it’s obvious to combine all of a pages Javascript into a single external file for efficiency purposes, but that’s not quite the question here.

Say I have Default.htm with a search field that has a little Javascript magic attached to it. Then I have Contact.htm with a contact form that has some Javascript magic attached to it. And finally I have a FAQ.htm with some jQuery panels showing the answers… you get the picture.

Basically I have three pages that all have “some” javascript need, but none of the Javascript is used on any other pages.

Is it better to combine all of that Javascript into one big minified file that loads once and is then stored in Cache, or is it better to use an individual Javascript file on the Default page, but not use it on the Contact page… etc?

What works best in this scenario?

Option: 1

Default.htm
jquery.js
default.js

Contact.htm
jquery.js
contact.js

Faq.htm
jquery.js
faq.js

Option: 2

Default.htm
jquery-default-contact-faq-min.js

Contact.htm
jquery-default-contact-faq-min.js

Faq.htm
jquery-default-contact-faq-min.js

PS: for all you asp.net guys, I’m using Combres to Combine, Minify, and Version my Javascript files

  • 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-05-16T16:53:11+00:00Added an answer on May 16, 2026 at 4:53 pm

    I would definitely vote to combine them. If you are concerned about parse or setup time for the “not used” Javascript, then I would recommend structuring your Javascript with each file in a closure, and then run the closures you need on the pages you need them. For example:

    // File 1
    window.closures = window.closures || {}
    window.closures["page1"] = (function() {
      // Javascript for Page 1
    });
    
    // File 2
    window.closures = window.closures || {}
    window.closures["page2"] = (function() {
      // Javascript for Page 2
    });    
    
    // File 3
    window.closures = window.closures || {}
    window.closures["page2"] = (function() {
      // Javascript for Page 2
    });
    

    Then, in your page:

    <!-- This one combined.js file will be downloaded once and cached //-->
    <script type="text/javascript" src="combined.js"></script>
    <script>
      // Run the Javascript in your combined.js intended for page2
      window.closures["page2"]()
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that all of these will be compiled together into one file but
I know that I can use git commit --amend --file=path-to-my-new-message but this will amend
I know that question was discussed plenty of times, but i tried all suggestions
I know that Job.all returns an array of all jobs. But, what would be
I know that there are hundreds of pages written on Django v Rails, but
I know that |DataDirectory| will resolve to App_Data in an ASP.NET application but is
I know that IList is the interface and List is the concrete type but
I know that design patterns is generally something that's connected to OO programming, but
I know that in Rails all ActiveRecord callbacks are executed inside transaction. So if
I know that there are more than a dozen questions about this. But I

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.