HTML and CSS Reference
Programmatically reformat : Using various server-side techniques, it's relatively simple to
strip (X)HTML of superfluous elements (such as images and styling) on the fly, serving
a bare-bones version of the site to mobile users. Doing so doesn't require a whole lot of
effort from your organization, but the result is still less than ideal. You don't have fine-
grained control over what mobile visitors see and don't see, and you may never be able to
trust that your reformatting algorithms are doing exactly what you'd like. Although faster
than SSR, this approach is still quite slow from a performance perspective.
Use “handheld” style sheets : As mentioned in Chapter 3, CSS defines a media attribute for
style sheets so that you can serve a particular style sheet only to mobile, or handheld,
devices. This technique offers you a great deal of control over the visual presentation of
your content on mobile devices, but not so much control over the context itself. It takes
some work on the part of your organization to get these handheld style sheets ready, but
once they are, they'll serve you well. Because there is no request-time processing being
done, this method is considerably faster than SSR or stripping elements from (X)HTML.
Create a mobile-specific site : You can create an entirely separate version of your site for
mobile devices (the convention is to house these at mobile. yourdomain .com ). While this is
obviously quite a lot of work, the result is that you have fine-grained control over every aspect
of the mobile display of your site, including the context. You can pick and choose to display
only the content that is contextually relevant to the mobile user (for more on contextual rele-
vance, see www2.jeffcroft.com/2006/mar/16/on-mobile-web-contextual-relevance/ ).
Generally this will be the fastest option, performance-wise, as it requires no request-time
processing and usually results in smaller (X)HTML and CSS files than the other methods.
Put simply, how to support mobile devices is not a binary matter—“do we support mobile
devices or not?” It should actually be a continuum of support, in which you can offer some
support with little to no effort, or great support with added effort. Fling sums this up with
a great graph, as shown in Figure 4-3.