In my article, “Optimizing Your Flash Site for Search Engines,” I mentioned my number one nemesis of SEO: JavaScript. While Flash can be read by some search engines, JavaScript absolutely cannot. I can understand the functionality and usability of JavaScript, but as an SEO, it makes my life miserable. Besides just optimizing it, I have to try and explain to a client why their website might not be as successful as they had hoped in the search engine results pages (SERPS).
As an SEO, I feel it is my duty and obligation to try and talk a client out of using JavaScript unless it is absolutely necessary. Using JavaScript for rollover links, navigation or even manipulating browser objects simply is NOT necessary in my book. But part of my job is also to use what is given to me, and make the most of it. It seems I do a lot of whining about JavaScript, but ultimately, I bear down, and do what it takes to optimize a JavaScript website.
Originally, I joked with the editor on initially writing this article as having two tutorials: the short one and the long version. The short version: DON’T DO IT!! All joking aside, it is important that you know right away that search engines cannot, and will not, read JavaScript. The long version is what I will be discussing with you today. In this article, I will explore options you have if you decide you must use JavaScript in your site functionality to optimize your site for search engines.
First, I want to look at why you might want use JavaScript in your website, and what its benefits are.
Functionality of JavaScript
JavaScript can provide functionality and interactivity to a web site like no other scripting language can. It’s relatively easy to understand, and a lot of people like it, because you can add snippets of code to a web page without having to utilize the resources of the web server. JavaScript is client-side code. Client-side code is scripts that are executed by a visitor’s browser instead of at the server.
The benefits of JavaScript are numerous, but the main benefits are server resource conservation. Being able to validate user input without having to send the input back to the server for validation is one of the prime examples of this. Server-side verification could be a time consuming process, as well as an increase on server load, network and web resources. Another benefit of JavaScript is when used properly, it helps conserve bandwidth. Conserving bandwidth is also important for server resources. By operating on the client-side, web pages and forms with JavaScript can speed up not only validation, but also with page load times.
Figure-1: A simple date script written in JavaScript shown in a web page