Using Web Technologies Unobtrusively

Each web technology, whether HTML, CSS, JavaScript, Flash, or anything else, has its own problems and challenges for being unobtrusive. Using a technology unobtrusively means the technology tests to see if it can be applied before applying itself.

In contrast, using a technology obtrusively means shoving it in people's faces, forcing them to use it whether or not they can. Here are some ways to use HTML, CSS, JavaScript, and Flash unobtrusively.

Unobtrusive HTML

Yes, I know HTML is always pretty unobtrusive. How many of your visitors are using a browser that doesn't support HTML? Maybe a couple of years ago I'd consider supporting Gopher, but I think today we can agree that HTML is the bare minimum we can require from our visitors.

Nonetheless, there are ways to abuse HTML and make it more dependent on other technologies and browsers, so let's look at some best practices for using HTML.

Always use valid HTML or XHTML

It doesn't really matter which type of HTML you choose to use, whether HTML 4.01 Transitional or XHTML 1.1 Strict. What's important is that you use it by the book (the book, in this case, being the W3C Specifications).

Using valid HTML isn't about being a perfectionist or being able to claim superior knowledge of the HTML specification. Using valid HTML means that you're creating a HTML document that is independent of any web browser differences.

When people make web browsers, they grab a copy of the same W3C Specifications in order to understand ...

Get Unobtrusive Ajax now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.