Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How bad is it to put javascript outside of the header?

The question pretty much already says everything.

I'm starting to add some features to my weekend project. It's a small app for me and a couple of friends, as we're exchange students it's kinda useful for us.

But the thing is the following, I'm doing this in php and structuring everything with includes so i can get the code separated. Some of these pieces of code are dependent on javascripts snipets, so how bad is it to put a javascript in the middle of the body? Or should i just make double includes so the javascript stays in the header?

like image 386
fmsf Avatar asked Feb 25 '09 00:02

fmsf


1 Answers

It's not bad at all.

It's actually considered good practice to put your script tags as late as possible in the page.

like image 147
Jim Puls Avatar answered Sep 28 '22 04:09

Jim Puls