SEO and JavaScript

JavaScript and its affect on the SEO of a website have been mentioned many times before on this blog, usually with negative conclusions. I’m going to “stick my neck out” here and claim it can actually help quite a bit (when done carefully and in the right way!).

The classic problem associated with JavaScript is that search engines can’t read it and so therefore can’t follow any instructions it gives, such as navigation links. For instance if a website’s entire navigation was constructed using JavaScript (so that you can have fancy rollovers and drop-downs, most of which can be done with CSS, incidentally), it wouldn’t be possible for a search engine to crawl and index, lessening its chances of decent rankings considerably.

Also, JavaScript actually written within the web page itself (as is usually the case) increases the amount of code a search engine spider has to go through before it gets to what it’s looking for – content. Increased file size on a high traffic site also slows page loading times and increases the strain on the server.

However, an age old problem with SEO – balancing content and design – can be cleverly fixed with the use of some simple but clever JavaScript. Using buttons created with JavaScript we can layer sections of the text so that only one portion is displayed at a time, meaning a large amount of text can be displayed in a small area. The content is all accessible by users and the JavaScript is non-intrusive – it doesn’t hide any content from the search engines.

However, it is important that the JavaScript function that creates this “tabbed” effect is written such that it degrades gracefully and all the content is visible when a user has JavaScript turned off. It would also be beneficial to put the JavaScript in an external file and link to it from within each page that needs it so that it only requires loading by the user’s browser once and doesn’t affect the code to text ratio on the actual web page.

Rik
SEO Programmer

  • Twitter
  • Sphinn
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • Wists
  • Tumblr
  • FriendFeed
  • Technorati
  • Reddit
  • Simpy
  • StumbleUpon
  • Slashdot
  • LinkedIn
  • Netvibes
  • Propeller

Leave a Reply