The href=”#” markup is pretty common in many HTML primers and most developers are used to seeing it, and don’t even question why it might be ‘bad’. Here’s the problem… “#” is supposed to be used for anchors within a page (for times when you want a user to be ‘scrolled’ to certain content on the (sometimes very long) page. Typically this is done to link from an index to specific paragraphs or chapters.


<a name="top"></a>
<a href="#chap1">Chapter 1</a>
<a href="#chap2">Chapter 2</a>
<a href="#chap3">Chapter 3</a>

<a name="chap1"></a>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque aliquet commodo diam. Ut scelerisque, nisl id laoreet consequat, pede lacus consequat est, id consectetuer neque augue a odio.
<a href="#top">Back to Top</a>
<a name="chap2"></a>Cras vel odio. Vestibulum fermentum rhoncus sapien. Donec vehicula euismod nunc. Duis malesuada erat non nulla. Cras ullamcorper diam ut ante. Nullam quam felis, suscipit vel, ultrices non, laoreet sit amet, nulla.
<a href="#top">Back to Top</a>
<a name="chap3"></a>Cras et sem vel enim hendrerit accumsan. Fusce lobortis lobortis quam. Proin egestas justo a purus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos.
<a href="#top">Back to Top</a>

The problem… and the cure…
If you use href="#" by itself, the browsers behavior is to take you to the very top of the page (like when it first loads). This is great on static sites, but as soon as you start adding some JavaScript events (onclick being most common), you’ll start seeing the problem.

Most developers, when coding the ‘onclick’ for an href, automatically (or by habit, or reliance on “tools”), stick the href=”#”…. by doing so, their action occurs, but as an unwanted side-effect, the browser also scrolls the content. This often takes an incredible amount of time for them to realize what’s really happened, particularly because you need enough content on the page to even see the scroll occur.

The solution, just replace the href=”#” to have a null javascript event… for compatibility with a wide variety of browsers, I recommend using href=”javascript:void(0);” in theses cases.

Good Luck!

<a href=”…” rel=”nofollow”>…</a>

In an effort to reduce what is commonly referred to as “Comment SPAM”, you should consider adding the rel=”nofollow” attribute to any ‘user provided’ link in your website (or Blog). Doing so will prevent many search engines (spiders) from giving the linked site additional ‘value’ or ‘relevance’ because of a multitude of links from around the web. It doesn’t remove ‘value’ from them, just makes your site not give them any additional weight.

To my knowledge; Google, Yahoo!, and MSN all support this markup.

Simply put… the intended effect of this is that any link containing rel=”nofollow” will allow both users and search engines to reach the site, but the existence of the link will not increase the ranking of the site in participating search engines.

Related info:

Senseo vs. Keurig

I mentioned Adam Curry in my earlier ‘Podcasting’ post… as such i’ll throw this into the mix.

Adam seems to prefer (and promote, thru his now infamous “burp”) his Senseo machine, personally I’ve got a Keurig B50 that provides my daily caffeine dosage, the big advantage of this machine is that there is a much wider variety of coffee and tea available.

It’s been a big hit with my guests, and there’s nothing better than your own cup o’ joe in about 10 seconds!


Just figured i’d share in the knowledge of this topic as it’s been a part of my life since about May 2005. Podcasting is essentially an MP3 (audio) blog, some have developed to the point of having adds or even being broadcast over satellite radio.

I’m subscribed to several podcasts, the most popular being Adam Curry‘s Daily Source Code…. yeah, for those of you that are my age, you’ll remember this guy as an MTV JV (as a regular top-40 jock as well as on HeadBangers Ball).

I don’t anticipate ever doing one of these on my own, but would be willing to provide some content for anyone that would like my input.

Listen in and enjoy!

MVC from a Java perspective.

I’ve been asked to explain this concept on a pretty regular basis by non-programmers… to a visual ‘presentation’ developer, this is essentially the same reason a person would chose to use CSS with HTML (to seperate data from presentation), only it goes a bit further…

  • Controller – extends HttpServlet, acts as the point of entry into the application, and delegates to various worker classes to fulfill a request. In particular, the Controller is a user of Model and View objects
  • Model – data-centric classes encapsulating problem domain objects. Each class corresponds roughly to the rows of a database table. Model objects can be constructed from a ResultSet of a database query, from user input, or from user request parameters.
  • View – implemented as Java Server Pages (or a similar tool), primarily concerned with presentation and formatting of Model objects which have been placed in scope by the Controller (or its delegate)


Using this will increase branding efforts by displaying and icon in the users browser while they are on the site, as well as showing it in their bookmarks.
If you do not add this file, there are two potential (neutral/negative) effects:

  • The default icon from the webserver may be shown (example: sun/iplanet).
  • The default icon from the browser will be shown – additionally resulting in a ”’404 Not Found”’ in your webserver logs.

The standard location for this file is the webserver root, you MAY specify other locations, but not all browsers will retrieve it (unless you explicitly define it in your HTML).
(i.e. http://domain.com/favicon.ico)

Additionally, to be selective you can add HTML markup to the <head> section of each page.


<link rel="SHORTCUT ICON" href="/favicon.ico" type="image/x-icon" title="FAVICON" />

NOTE: title is optional, type is preferred, rel and href are mandatory.



Gradient HTML

Provided that all of the ‘buttons’ in your application already use the HTML <button> tag, this is a simple matter to accomplish:
1. Modify your CSS to include the following:

button{background:#eee url(../images/button.png);}

2. Upload the gradient image that you intend to use. (in this example button.png)

3. Done.

For your convenience, the image I use is available here (Gradient Button Background Image)

NOTE: MSIE exhibits some poor caching behaviours when background images are used, look for a post on this elsewhere in my blog.


I’ve been asked about this file in many projects i’ve worked on. It resides in the root of the website, and has no external references to it, however, there is usually a lot of requests for it in the server logs. (Or… “404 Not Found” Errors if it doesn’t exist).

Additionally, automated security audit software will often indicate that this file itself is a possible security problem as it can expose hidden areas of your website (more on this later).

Here’s what it’s all about….

ROBOTS.TXT is used by spiders and robots, primarily so that they can index your website for search engines (which is usually a good thing). However…. there are times when you don’t want this to occur. Some spiders/robots can be too agressive on your servers, consuming precious bandwidth and CPU utilization, or they can dig too deep into your content. As such you might want to control their access.

The Robots Exclusion Protocol sets out several ways to accomplish this goal. Of course the spider must comply with this convention.
1. ROBOTS.TXT can be used to limit the access:

Example that limits only the images, javascript and css folders:

#robots.txt - for info see http://www.robotstxt.org/wc/robots.html
User-agent: *
Disallow: /images/
Disallow: /js/
Disallow: /css/

2. A <meta> tag on each webpage indicating spider actions to take.

<meta name="robots" content="INDEX, FOLLOW, ALL" />

Values, there are a few other attributes, but these are the most common….
INDEX -index this page
NOINDEX – do not index this page
FOLLOW -follow links from this page
NOFOLLOW -do not follow links from this page

In most cases, a spider/robot will first request the ROBOTS.TXT file, and then start indexing the site. You can exclude all or specific spiders from individual files or directories.

As for the earlier bit on security, since this file is available to anyone, you should never indicate sensitive areas of your website in this file as it would be an easy way to find those areas.

Disabling the HTML <font> tag

Oreilly has a great way of making the <font></font> tag non-functional in cases where the content may contain it (for uncontrollable reasons):

Mind you, this won’t validate properly, but it will disable the usefulness of the tag itself.

Add the following to your CSS definitions

font { color: inherit !important;
background: inherit !important;
font-family: inherit !important;
font-size: inherit !important; }

Recommended ‘simple’ replacement for the tag (when you don’t have time to restructure the entire site) is to use the <span></span> tag with appropriate styles to replace all instances of the <font></font> tag in the markup.