The Use Of JavaScript

JavaScript is commonly used to enhance web pages and increase functionality. JavaScript can be used to do things such as display the visitors name on a web page, show the current date and time, or track items placed in a shopping cart.

JavaScript can however cause problems with search engines as robots are unable to interpret JavaScript the same as a web browser does. Spiders cannot follow hyperlinks in JavaScript code, which can dramatically reduce the number of pages that will be spidered / indexed from your website. Furthermore, search engines will not see images, text or any formatting done in JavaScript.

Correctly Using JavaScript

Given that spiders cannot understand JavaScript, and because JavaScript is not naturally "keyword rich", we recommend placing all JavaScript in external files and "pointing" to them instead of placing the entire JavaScript code on the page, this will also reduce bandwidth & loading time because the HTML source will not contain the JavaScript. Simply copy your JavaScript to a text file, and save it anywhere on your website with a .js extension, then it will be ready to link to.

Here is a code example of a link to an external JavaScript file (notice that this code is placed just before the closing of the tag):