Use META tags delicately
Twitter user benschwarz just announced an attractive new facelift for the W3C HTML5 spec for authors.
The new design uses em units which (on my screen) renders to a body width of about 640 pixels wide. Save for a naughty fieldset which strays outside of its yard, everything fits within this tight column, making for lines with reasonable word count.
This rant isn't about the appearance of the page, though. It’s about a little oversight in the way the page was coded. As I mentioned above, I found out about this page through a Tweet, and more often than not, I'm browsing Twitter on my iPhone. Here’s what that looked like:
Naturally I tried a little bit of pinch-to-zoom out action, but to no avail. Landscape mode wasn't much help, either. The problem here is that the author(s) of these pages decided to include the increasingly commonly used viewport meta tag.
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
If you're not familiar, the viewport meta tag was introduced by Apple to help developers improve the presentation of their pages when viewed on mobile devices (namely the iPhone, iPod Touch), and was later adopted by other browser vendors.
In this specific instance, the viewport tag is telling the browser to set the logical width of the page to the 'device-width' (being 320px in portrait, or 480px in landscape, on the iPhone), instructing that the initial zoom level is 1:1, and telling the browser to disallow zoom capability. It’s that last bit there that is troubling. Usually when developing a "web app" specific to mobile, the developer keeps in mind sizing constraints and sizes all the elements (text, buttons) on the page accordingly. In these cases, zooming in or out may distract from the app’s functionality, or not be necessary. For example, when developing a web app, an author would rarely (if ever) allow elements to render off-screen (scrolling elements aside).
In the case of developing for the desktop, however, where layouts are frequently larger than the screen size of most common mobile devices, the last thing you'd want to do is render a page full size, then tell the mobile user that they have to scroll through the entire document (namely left to right, in order to read every line) just to see it! In the case of this particular series of pages, the viewport meta tag is completely unnecessary (the iPhone, and I expect most other browsers, would have rendered the page 'properly' — as one would normally expect it to be rendered), and indeed actually causes more problems than it fixed.
Developing for mobile is receiving increasing amounts of attention as of late, and mobile use is growing exponentially. It’s an exciting new area for developers to explore, but we can't just take 'off the shelf' solutions, slap them on our pages, and expect everything to be just fine. When developing pages, please take care to use coding techniques appropriately, and be especially careful when using new[er] techniques that may affect users in adverse ways. If you want your content to be read, know that most users will abandon your page at the first annoying hurdle they encounter.