Search Engines and JavaScript

Are you using JavaScript as a main navigation scheme, such as for HTML (form) drop-down menus? Are you using it for DHTML drop-down menus? Are any of your links to pop-up windows? If so, how many? Or, do you simply place mouseovers on your navigation buttons? Many people who create framed sites use JavaScript to keep frames intact at all times.

When you use JavaScript on a site’s navigation scheme, the scripts can greatly decrease the “crawlability” of the links. Currently, most search engines won’t follow the links embedded inside JavaScript code (including mouseovers and menus), or they greatly limit the types of JavaScript-embedded links they’ll crawl.

Some JavaScript code is more search engine friendly than others. As a general rule of thumb, the simpler the script is, the more likely a search engine spider can crawl the link.

JavaScript Links

Search engine representatives give rather vague answers when asked whether they index links surrounded by JavaScript. One of my colleagues received this answer at a recent search engine conference, “We reserve the right to index JavaScript.” Basically, when you deal with JavaScript and the search engines, it’s hit-or-miss.

Gambling and adult sites are among the biggest JavaScript abusers. If you click a link, multiple windows may open. If you enter a site, a window often pops under the main one. If you try to leave a site, another window opens. Other common JavaScript abuses include fast redirects and hiding spam techniques.

In all likelihood, spam abuse is why search engines “reserve the right” to index JavaScript links.

My advice is to always design a site with at least two forms of navigation: one that’s 100 percent search engine friendly and one that may be less search engine friendly. If I design a site with DHTML menus, I always have a corresponding navigation scheme of text links at the bottom of a page. If that’s too many links, I cross-link pages via contextual links (also known as breadcrumbs) and embedded links in the main content.

I always have a site map link on every page. It’s never hidden from viewers. Don’t try to hide a site map link in a transparent GIF or hidden text. It can get your site in trouble.


In the event older browsers don’t support JavaScript or users have disabled it, the

I usually place a link to the site map page in the

JavaScript and Spam

Some search engine marketers abuse the

Never use this tag to hide any unrelated content or links you wouldn’t otherwise show site visitors.

Due to this tag’s widespread abuse, most search engines either ignore or decrease the relevancy of the text inside it. Additionally, most end users will never see the content. Search engines tend to ignore all “hidden” tags or at least not use them to determine relevancy.

When I was called on as a search engine expert in court a few years ago, I discovered something as simple as a mouseover and redirect were used to divert traffic from a spam site to the actual site. From a Web site owner’s perspective, JavaScript can benefit the user experience. From the search engine’s perspective, JavaScript can be a red flag for spam.

Before adding any type of JavaScript and

Want more search information? ClickZ SEM Archives contain all our search columns, organized by topic.

Related reading