Where to locate JavaScript code

September 26th, 2006

by

Q: Does it matter whether the JavaScript code is in the section or the , as far as affecting Google spiders?

A: Either place will work, but JavaScript code that’s high up in the page pushes your keyword-rich body copy lower down the page, which in turns lowers the keyword prominence of the keywords in that copy. So ideally, donĂ¢??t include the JavaScript functions “inline” but instead place them in a separate .js file and simply reference that .js file in the of your page. Or, placing JavaScript code low in the towards the end of the page can work as well.