BolderImage

Blog Subscribe to our blog Subscribe to our RSS blog feed Bookmark and Share

More Blog Entries




How to Use Javascript Effectively Without Hurting Your Web Site Search Engine Optimization
03/05/09


I have a love/hate relationship with javascript (my best geek statement to date). You can create some of the coolest stuff in the browser with well-written javascript. There are also thousands of available javascript plugins for websites - that's the love part. However, I also hate it because the language is case-sensitive and each browser can interpret the instructions differently (especially Internet Explorer).

 

Much more importantly though, a web developer must understand when to use javascript and when not to. Choose an item in this drop-down list:

 

 

 

 

So what's going on here, exactly? There's a snippet of Javascript that dynamically changes the content in an HTML layer each time you make a selection from the drop-down list. Ok, so why should you care? Well...

 

None of the search engine crawlers read dynamic javascript content. And they can't submit forms, such as a contact form). So the point is, my content in the HTML layer above will never be crawled by any search engine, and therefore never be indexed. Meaning, you guessed it, never showing up in any search results on Google, Yahoo, MSN, and all the rest. If you have a page on your website that uses a drop-down list to link to, or display content, you are deliberately hiding that content from search engines!

 

Lesson #1 regarding javascript - don't make content that is important to your web site's search engine ranking available only through javascript methods. It will never be found!

 

So what's an alternative to using a drop-down list to display information or link to other pages? Make sure your content can be found other ways, like a site map (that doesn't use javascript). Another method I like is the use of collapsing/expanding HTML layers. Click an item on this list:

 

Pizza
Hamburgers
Hot Dogs

 

 

The difference here is that the content is on the page in the HTML code; it's just hidden from view of the browser. Javascript simply shows and hides each layer when you click on its anchor tag. Since the content is always in the HTML (whether visible or not), it always gets crawled by search engines. Remember, search engines ignore javascript, and they don't care if the layer is hidden or not; they still look at the page's underlying HTML code.

 

If you're unsure how javascript is being used on your website, give us a call or fill out our contact form. We would be happy to evaluate the underlying code and let you know if search engines can see your content.

- Barry Koehler
Web Programming Manager

Tags: SEO javascript tech 

Leave a Comment