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 4112152
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:09:31+00:00 2026-05-20T22:09:31+00:00

I really like to know why people say put external resorces on the head

  • 0

I really like to know why people say “put external resorces on the head of the page”, such as :

<head>
    <script type="text/javascript" src="settings/myJavascript.js"></script>         
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link type="text/css" rel="stylesheet" href="settings/style.css" title="Style" media="all" />
</head>

Is it not better to add these resources to the page only if it needs those resources? For example, when programming on PHP, if I have a page that needs some CSS instead of other that don’t need it, will it be more intelligent to use link type or script src into that page, without loading everything in the top, isn’t it?

I see many suggestions on forum/community that say to put ALL in the head… what can you say?

  • 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-20T22:09:31+00:00Added an answer on May 20, 2026 at 10:09 pm

    There are two things here, and I’m not sure which you are asking about.

    Saying they should be in the <head> can mean as opposed to elsewhere in the document. Some people do put CSS links in the body, even though they aren’t allowed there, and also while <script> is allowed in the body, it’s almost always a better idea to put it in the head (and those cases where it isn’t should be obvious, and even though can often be re-written to work better from the head, with the exception of cut-and-paste scripts relating to other services, where e.g. amazon give you a script to put in your page that they want to make simple for you, rather than requiring serious re-writing of your code).

    As for whether it should only be in those pages that need them, there is a balance here.

    Firstly, let’s say that 90% of a CSS stylesheet’s declarations are used on all pages in a site (this is a sign of a well thought-out style in itself). We could put the other 10% in separate files for some pages only, and indeed more likely 2% in one, 3% in another and 5% in yet another or something like that. However, since each URI access has its own overhead on top of the bandwidth of the actual stream downloaded, we probably lose more than we gain here.

    Add in the effect of caching, and keeping it in one file is a clear winner.

    On the other hand, say there are a set of resources in a site that have very different styling needs to the others. In this case the separate CSS might be as large or larger than the first one, so it makes more sense to have that as a separate file only used where necessary (also, it can make over-riding in the cascade work much better, e.g. if the “main” stylesheet gives a blue background then the second can give a red background and we indicate which we need simply by whether that stylesheet is there or not, without having to set different classes throughout the relevant HTML pages).

    The same applies to javascript, a couple of functions used only rarely should probably still be in the “common” javascript files, but a large set of functions for use only in one page should almost certainly only be loaded in that one page.

    That said, we may choose to include the second js in a relatively light page that is likely to be hit before a relatively heavy page that will use it, just to take advantage of the caching. This latter I would consider more an optimisation of the site as a whole, than a concern of the design of that one page (considered as an individual page, the second js is clearly wasteful).

    Edit:

    Finally, it’s just simpler to have a single file handling all of these items, and the waste in a few extra downloads may be justified by the reduced maintenance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would really like to know how web sites decide what ad to show
Ok I really would like to know how expert MVVM developers handle an openfile
I know this isn't a programming question but I would really like the users
Do you know a alternative to module ? I really like load/unloading with it,
Does anyone know of an equivalent to FxCop/StyleCop for Delphi? I would really like
I'm new to jQuery and really liking it. I'd like to know if there's
I would like to dive into the world of SharePoint, but don't really know
I really like the way the system applications (People, messages, mail, music+video, etc) are
I really like the magento structure but finding things is very hard ;) My
I really like the MVC way and have actually enjoyed learning ASP.NET MVC (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.