JavaScript Editor Ajax software     Free javascripts 



Main Page

JavaScript Links
The first scenario discussed is the use of JavaScript code for navigation. A JavaScript link is any button
or text that, when clicked, navigates to another page. A typical JavaScript link looks like this:
<a href=”#“ onClick=”location.href=’http://www.example.com’; return false;”>Some
Text Here</a>
The primary objection to using this sort of link is its use of JavaScript where a regular link would suffice.
Doing so will typically prevent a search engine spider from following the links, and also prevent users who
disable JavaScript from navigating your site. Using them for
all
navigation may prevent a site from being
spidered at all. If you must use such links, provide alternative navigation somewhere else on the site.
The same issues would also be apparent in navigation involving other client-side dynamic technologies
such as Java applets, AJAX content, and Flash. In general, any navigation not achieved using a standard
anchor (
<a>)
tag will hinder site spidering.
Some webmasters have reported that spiders, especially Google, seem to be following some obvious-looking
JavaScript links in their sites. However, because this is the exception rather than the rule, depending on
this is not recommended.
By the same token, using JavaScript as a sort of page exclusion protocol, that is, assuming spiders do not
see or crawl links in JavaScript, is also unwise. Even if the JavaScript does achieve the end of obscuring
the link from spiders, other sites may link to the URL, which would likely get the page indexed regard-
less. If you don’t want a link to be indexed, you should exclude it using
robots.txt
or using the meta
exclusion tag.
DHTML Menus
Because they’re based on JavaScript, DHTML drop-down menus present problems for search engines
as well. It is wise to provide alternative navigation to all elements listed in the menus. You can do this
using a set of links at the bottom of the page, a sitemap, or a combination thereof. This way not only
search engines, but visitors with JavaScript support disabled, will be able to navigate the site with ease.
Many drop-down menus are somewhat spider-friendly, whereas others are not at all. The ones that are
not
tend to generate and display HTML on-the-fly using JavaScript. The ones that
are
typically hide and
unhide an HTML
div
element dynamically. The key here is that the HTML and links are actually pres-
ent, though hidden, in the document. Search engine algorithms may not, however, appreciate the hidden
aspect — rendering it an
invisible
on-page factor. It is wise to list the links
visibly
elsewhere in either case.
Popup Windows
The typical method of displaying popups employs JavaScript. And, as you learned, a search engine will
likely not spider a page only referred to by JavaScript. So what if you
do
want a popup to be indexed?
121
Chapter 6: SE-Friendly HTML and JavaScript
c06.qxd:c06 10:55 121


JavaScript Editor Ajax software     Free javascripts