0

Scripts should be included in the <head> part is what I learned from w3c.

Why does Boostrap suggest to load itself in the <body> part as seen here:

http://getbootstrap.com/getting-started/#template

madth3
  • 7,275
  • 12
  • 50
  • 74
Daniel W.
  • 31,164
  • 13
  • 93
  • 151
  • Where does w3c say that it **should** be included in the `` ? – Tim B James Aug 26 '13 at 10:36
  • @TimBJames after researching, indeed: _The SCRIPT element places a script within a document. This element may appear any number of times in the HEAD or BODY of an HTML document._ http://www.w3.org/TR/html401/interact/scripts.html – Daniel W. Aug 26 '13 at 10:42

2 Answers2

0

Scripts are technically supposed to be loaded and executed at where they are placed in the body. Imagine that your browser reads your HTML from top to bottom. If the script include is at the top of the document, then the browser is supposed to idle while it fetches the script from the web server.

A more detailed answer is available at
Unobtrusive JavaScript: <script> at the top or the bottom of the HTML code?

Community
  • 1
  • 1
Warty
  • 7,237
  • 1
  • 31
  • 49
0

if the loading script is at the bottom of the body tage then it will be loaded last, making the rest of the page appear as if it is loaded faster

That really depends on that is on your page. If your page has things that need the js in order to work before displaying to the user, it would be wiser to load them before showing the html to the user

Nick Ginanto
  • 31,090
  • 47
  • 134
  • 244