graphic with four colored squares
Cover page images (keys)

mobileOK Basic for Developers

EU FP7 Logo
Supported by MobiWeb2.0,
funded by the European Union

François Daoust, Mobile Web Best Practices Working Group Staff Contact

http://www.w3.org/2008/Talks/04-overtheair/
Shorter URI: http://tinyurl.com/224e9x

Over the Air
London, United Kingdom, 4 April 2008

Foreword (1/2)

This talk is about...

This talk is not about...

... although I would be happy to talk about these points, feel free to ask!

Foreword (2/2)

Best viewed with...

→ Switching between windows may turn out to be a perilous live exercise.
(the slides include some screenshots, just in case)

Menu page

Links to the examples are available from the following menu page:

The Web: tomorrow's Mobile platform (1/2)

Main choices available?

There will always be a need for native/Java applications, but...

The Web will be the main mobile development plaform in the future!

The Web: tomorrow's Mobile platform (2/2)

Picture of an iPhone

The iPhone is a perfect example of a mobile phone that promotes the use of the Mobile Web as the development platform for applications:

Introducing mobileOK Basic (1/3)

Best Practices flipcards Back to topic:

Mobile Web pages need to rely on solid foundations so that it's easier to build on top of them.

→ the Mobile Web Best Practices 1.0 document is here to help:

  • Set of 60 best practices to keep in mind when creating mobile content.
  • Summarized in handy flipcards!

Introducing mobileOK Basic (2/3)

What is mobileOK Basic?

Introducing mobileOK Basic (3/3)

mobileOK applies to an hypothetical default delivery context (DDC)
The defaut delivery context properties

NB: DDC is "the minimum delivery context specification necessary for a reasonable experience of the Web".
Do not target the DDC if you know better about the user's phone capacities!

mobileOK Basic checkers

Several implementations of mobileOK Basic checkers already exist:

W3C mobileOK Basic checker

Example: Beethoven lyrics

- desktop -
Beethoven - bad - desktop
- phone -
Beethoven - bad - phone

What does the checker have to say on a Web page that "looks" just fine?

View page, View checker's report

Before we come back and fix the page, let's:

  • see what a mobileOK Basic template looks like
  • learn a few best practices, and how the mobileOK checker helps addressing them
  • remind ourselves that the checker helps, but thinking is still required!

Hello mobileOK! page (1/3)

- desktop -
Hello mOK - desktop
- phone -
Hello mOK - phone

Let's build a mobileOK Basic template page from scratch

<html>
  <body>
    <p>
      Hello mobileOK!
    </p>
  </body>
</html>

View page, View checker's report

→ We need to be explicit about the content of the page.

The more explicit, the easier for the browser to render the page.
Standards mode - as opposed to Quirks mode - is less CPU-intensive.

Hello mobileOK! page (2/3)

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
 "-//W3C//DTD XHTML Basic 1.1//EN"
 "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <p>
      Hello mobileOK!
    </p>
  </body>
</html>

View page, View checker report

→ The title is missing. It should be short and descriptive.

Hello mobileOK! page (3/3)

- desktop -
Hello mOK - desktop
- phone -
Hello mOK - phone

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
 "-//W3C//DTD XHTML Basic 1.1//EN"
 "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>mOK Basic</title>
  </head>
  <body>
    <p>
      Hello mobileOK!
    </p>
  </body>
</html>

View page, View checker report

Stylesheets (1/3)

Internal vs. External

Internal

<style type="text/css">
  blah... blah...
</style>

External

<link rel="stylesheet"
 type="text/css"
 href="styles.css" />

Stylesheets (2/3)

The @media rules

<link rel="stylesheet" type="text/css"
 media="screen" href="screen.css" />
<link rel="stylesheet" type="text/css"
 media="handheld" href="handheld.css" />

Warning: so-called full-web browsers usually download the screen stylesheet..
Use more specific @media queries in that case.

For instance, for the iPhone:

<link rel="stylesheet" type="text/css"
 media="only screen and (max-device-width: 480px)" href="handheld.css" />

Stylesheets (3/3)

The mobileOK Basic template with CSS

- desktop -
Hello mOK - desktop
- phone -
Hello mOK - phone

template4.html

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
 "-//W3C//DTD XHTML Basic 1.1//EN"
 "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>mOK Basic</title>
    <link rel="stylesheet" type="text/css"
          media="screen" href="screen.css" />
    <link rel="stylesheet" type="text/css"
          media="handheld" href="handheld.css" />
  </head>
  <body>
    <p>Hello mobileOK!</p>
  </body>
</html>

screen.css

p { font-size: 2em; }
body:after { content: url(W3C-MWI-large.png) }

handheld.css

p { font-size: 0.5em; }

View page, View checker report

Images

- desktop -
Images - bad - desktop

Bad: View page, View checker report

Good: View page, View checker report

Page size (1/2)

- desktop -
Page size - bad - desktop

Bad: View page, View checker report

Page size (2/2)

- desktop -
Page size - good - desktop

Good: View page, View checker report

Tables for layout is bad

- desktop -
Table for layout - desktop
- phone -
Table for layout - phone

Bad: View page, View checker report

CSS layout is good

- desktop -
CSS layout - desktop
- phone -
CSS layout - phone

Good: View page, View checker report

Dynamic content (1/2)

- desktop -
Scripting - desktop
- phone -
Scripting - phoneScripting - phone
Scripting - phone

Bad: View page, View checker report

You may use scripting but don't rely on it!

  • Javascript links are bad:
    <a href="javascript:submit();">Link</a>
    Use events instead, and provide a default action:
    <a href="page.html" onclick="submit();">Link</a>
  • Use Javascript reflection for determining support:
    if (window.ActiveXObject) {
      // Instantiate using new ActiveXObject
    } else if (window.XMLHttpRequest) {
      // Instantiate using new XMLHttpRequest
    }
  • Degrade gracefully

Dynamic content (2/2)

- desktop -
Scripting - desktop
- phone -
Scripting - phoneScripting - phone
Scripting - phone

Good: View page, View checker report

Other Best Practices in a snap

Say no to...

Say no to Frames  Say no to pop ups  Say no to image maps

Use but do not rely exclusively on...

Do not rely on cookies  Do not rely on font effects

Back to: Beethoven lyrics

- desktop -
Beethoven - desktop
- phone -
Beethoven - phone

Remember the Beethoven lyrics page that "looked" just fine?

Using the checker's report and our knowledge of Best Practices, we may now fix the page by:

Good: View page, View checker's report

Related works within W3C (1/2)

Within the Mobile Web Initiative:

Related works within W3C (2/2)

In other working groups:

Conclusion

Best Practices flipcards

The end

Contact

François Daoust <fd@w3.org>

Staff Contact for the Mobile Web Best Practices Working Group

Questions?

Credits

EU FP7 Logo
Supported by MobiWeb2.0,
funded by the European Union