desktop site from a mobile device, the
Web application often will read the
user-agent HTTP header to detect the
request is from a mobile device. The
application then can send an HTTP
301 (or 302) response with an empty
body and a Location header, redirecting the user to the mobile version of
the site as required. However, the extra round-trip to the client and back to
the mobile site often consumes several hundred milliseconds over mobile
networks. Instead, it is faster to deliver the mobile Web page directly in
response to the original request, rather than delivering a redirect message
that then requests the mobile page.
As a courtesy to users who prefer to
view the desktop site even on their mobile devices, you can provide a link on
the mobile site that signals your application to suppress this behavior.
Ease of implementation. While this
technique is easy in theory, it may not
always be possible to put into practice.
Many sites redirect to a different server for their m.sites, since those may
be hosted elsewhere. Other sites send
cookies with the redirect to tell the
Web application that they are mobile
once they redirect. This may be more
difficult to control, depending on the
Size matters. Smaller pages render faster, and smaller resources are fetched
faster. Reducing the size of each server
response does not usually help performance as much as reducing the number of responses needed for each page.
Several techniques, however, do yield a
net benefit for performance, especially
on mobile devices where bandwidth
and processing power must be managed wisely.
Compress Text and Images.
Compression technologies such as gzip
reduce payloads at the slight cost of
adding processing steps to compress
on the server and decompress in the
browser. These operations are highly
optimized, however, and tests show
that the overall effect is a net improvement in performance. Text-based
responses, including HTML, XML,
size by as much as 70%.
Browsers announce their decom-
pression capabilities in the Accept-
Encoding request header, and they
perform decompression automatically
when servers signal that a response is
compressed in the Content-Encoding