You are previewing Programming the Mobile Web.

Programming the Mobile Web

Cover of Programming the Mobile Web by Maximiliano Firtman Published by O'Reilly Media, Inc.
  1. Programming the Mobile Web
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Preface
      1. Who This Book Is For
      2. Who This Book Is Not For
      3. What You’ll Learn
      4. Other Options
      5. If You Like (or Don’t Like) This Book
      6. Conventions Used in This Book
      7. Using Code Examples
      8. How to Contact Us
      9. Safari® Books Online
      10. Acknowledgments
    3. 1. The Mobile Jungle
      1. Myths of the Mobile Web
      2. The Mobile Ecosystem
      3. Mobile Knowledge
      4. Brands, Models, and Platforms
      5. Technical Information
      6. Market Statistics
    4. 2. Mobile Browsing
      1. The Mobile Browsing Experience
      2. Mobile Web Eras
    5. 3. Architecture and Design
      1. Website Architecture
      2. Design and Usability
    6. 4. Setting Up Your Environment
      1. Setting Up a Development Environment
      2. Production Environment
    7. 5. Markups and Standards
      1. First, the Old Ones
      2. Current Standards
      3. XHTML Mobile Profile and Basic
      4. CSS for Mobile
      5. Confusion
    8. 6. Coding Markup
      1. Heading Structure
      2. The Document Body
      3. Plug-ins and Extensions
    9. 7. CSS for Mobile Browsers
      1. Where to Insert the CSS
      2. Selectors
      3. CSS Techniques
      4. Common Patterns
      5. CSS Sprites
      6. WebKit Extensions
    10. 8. JavaScript Mobile
      1. Supported Technologies
      2. Coding JavaScript for Mobile Browsers
    11. 9. Ajax, RIA, and HTML 5
      1. Ajax Support
      2. JavaScript Libraries
      3. WebKit CSS Extensions
      4. Mobile Rich Internet Applications
      5. HTML 5
    12. 10. Server-Side Browser Detection and Content Delivery
      1. Mobile Detection
      2. Content Delivery
      3. Multimedia and Streaming
      4. Content Adaptation
      5. Mobilizing WordPress and Other CMSs
    13. 11. Geolocation and Maps
      1. Location Techniques
      2. Detecting the Location
      3. Showing a Map
    14. 12. Widgets and Offline Webapps
      1. Mobile Widget Platforms
      2. Standards
      3. Platforms
      4. Widget Design Patterns
    15. 13. Testing, Debugging, and Performance
      1. Testing and Debugging
      2. Performance Optimization
    16. 14. Distribution and Social Web 2.0
      1. Mobile SEO
      2. Mobile Web Statistics
      3. Mobile Web Advertising
      4. Mobile Web Social Features
    17. A. MIME Types for Mobile Content
      1. Markup and Script MIME Types
      2. Image MIME Types
      3. Mobile Content MIME Types
      4. Audio and Video MIME Types
      5. Widget and Webapp MIME Types
    18. Index
    19. About the Author
    20. Colophon
    21. SPECIAL OFFER: Upgrade this ebook with O’Reilly
O'Reilly logo

XHTML Mobile Profile and Basic

XHTML MP is based on the W3C’s XHTML Basic, and they are almost the same. The W3C has an online mobile validator at http://validator.w3.org/mobile; it accepts XHTML Basic and MP as valid markup.

XHTML Mobile Profile is a subset of XHTML. It is XML-based, so we need to follow the strict rules. If you have never worked with XHTML 1.0 or 1.1 for the Web, let’s analyze the differences compared with working with HTML:

  • The file must have a root element (html tag).

  • Every tag name and tag attribute must be in lowercase.

  • Every attribute value must be enclosed in quotes.

  • Every tag must be closed. This may seem obvious, but it is not; tags like <img>, <input>, and <br> don’t need to be closed in HTML, but they do need to be closed in XHTML. The general rule is to use self-closed tags, like <br />.

  • The tags need to be closed in reverse order. If you open a paragraph and then a link, you must close the link before closing the paragraph.

  • XHTML entities must be well formed. A mandatory space should be &nbsp; and an ampersand character should be &amp;.

  • All attributes must have a value. For example, <option selected> is invalid; you must use <option selected="selected">.

  • The DOCTYPE declaration is mandatory, and the XML opening tag is optional. In fact, for mobile browsers we should not insert the XML opening tag.

Warning

This is not a book about XHTML, CSS, or even JavaScript. I assume you have some basic experience with these markup and programming languages; if not, you will ...

The best content for your career. Discover unlimited learning on demand for around $1/day.