Posted by & filed under Search Engine Optimisation, Web Development.

I just read yet another misleading article from yet another “leading” SEO writer explaing why JavaScript is bad for your navigation. And yet again (yawn) it showed a complete lack of understanding of the capabilities of search engines (quite aside from the fact that Google understands some aspects of JavaScript now, but that’s another story).

The essense of the piece I read was that if you use JavaScript to “pop-up” sub-menus, then your site navigation won’t be indexed by search engines.  You’ve probably read similar claims hundreds of times also.

Here is why that is an over-simplicification, and to most intents and purposes, completely wrong.

Most (not all mind) JavaScript pop-up menus rely on JavaScript controlling the “display” or “visibility” or “z-Index” CSS of an HTML div layer or layers to control the pop-up.  Others switch the innerHTML in and out of other HTML div layers that remain permanently hidden by one of those same CSS methods.  Another way is to use JavaScript to swap a CSS class from one where the div layer is hidden to one where it displays (and back again).

In each of those examples, the links that make up the sub-menu items are able to be physically on-page, and indexable, as they are just standard HTML. In fact, the JavaScript is by-and-large irrelavant to their rendering (they are only “hidden” by CSS – JavaScript is manipulating that!).

This means that menus created in those ways are indexable in a way that is virually identical to HTML only or HTML/CSS menus.  There only differences perhaps being the subtle nuances of importance implied by the particular HTML mark-up used.

There are a few things to avoid though:

Never use JavaScript for the links themselves.  While Google now makes a good attempt to understand most JavaScript it encounters, each step away from HTML is a step away from a search engines rendering comfort zone.  Stick with using JavaScript to manipulate the HTML and CSS, and you’ll be safe.

Secondly, don’t “hide” HTML in an unsafe manner.  Search engines expect to find hidden div layers for navigation (several people believe hiding HTML will incur a search egnines wrath as an extension of the issue I’m about to highlight here).  However, search engines are also on the lookout for sites “hiding” text content from users for no good reason.  If your hidden HTML contains text significantly more than links, it is likely to look like a cheap attempt to cloak.  Even links set up in a non-menu way might trigger suspicion.  Avoid hiding div layers by poisitoning them with negative left margins greater than their width, and so on.  These are red flags to Matt Cutt’s spam police, even though they could be forgivable for a menu.  Avoid anything that puts you on the radar of the spam police!

Finally, don’t use use CSS to hide any other text on your page without good reason – for example as storage for text used in a marquee display – as this is almost certain to trigger spam filters and bring you to the attention of Matt Cutts’ team.  He’s a nice guy, but he’s a trained spam killer!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>