Where to place JavaScript in an HTML file? -


say have hefty javascript file, packed down 100kb or so. file mean it’s external file linked in via <script src="...">, not pasted html itself.

where’s best place put in html?

<html> <head>     <!-- here? -->     <link rel="stylesheet" href="stylez.css" type="text/css" />     <!-- here? --> </head> <body>     <!-- here? -->     <p>all page content ...</p>     <!-- or here? --> </body> </html> 

will there functional difference between each of options?

the yahoo! exceptional performance team recommend placing scripts @ bottom of page because of way browsers download components.

of course levi's comment "just before need , no sooner" correct answer, i.e. "it depends".


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -