Last, but not least, we come to JavaScript: the last pillar of mobile web development. Unfortunately, JavaScript simply hasn’t been a priority in mobile browsers for many years, due to the hardware limitations of devices. I frankly consider myself lucky to be dealing with a device that has decent CSS support, and if I have devices that support a little bit of JavaScript as well, then I’m ecstatic.
The bad news is that unless you are targeting Class A browsers, JavaScript just can’t be assumed in your mobile project. I know this can be a potential barrier to entry for many mobile web projects, but it doesn’t have to be. Just go back to the concepts of progressive enhancement that I talked about at the beginning of this chapter, and start to map out how your experience will degrade to each of the device classes you plan to support.
The good news is that we are starting to see widespread JavaScript support in multiple mobile browsers with Class A browsers and a few Class B browsers. Some devices, like the iPhone, are taking JavaScript to a new art form (which I will discuss more in the next chapter). As devices get more powerful and browser engines more adept at processing JavaScript, I have a feeling that this problem will go away soon.
TABLE 11-8 shows that JavaScript is available only in a few devices.
| Class A | Class B | Class C | Class D | Class F | |
| JavaScript support | Yes | Some | No | No | No |
| DHTML | Yes | Limited | No | No | No |
| Ajax | Yes | Limited | No | No | No |